Skip to content

Fix: declare ft_printf with extern "C" in print.hpp#32

Merged
Tripouille merged 2 commits into
masterfrom
copilot/add-extern-c-for-ft-printf
Mar 14, 2026
Merged

Fix: declare ft_printf with extern "C" in print.hpp#32
Tripouille merged 2 commits into
masterfrom
copilot/add-extern-c-for-ft-printf

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

ft_printf was called in utils/print.hpp without a declaration, causing a compile error when the C function was referenced from C++ translation units due to name mangling.

Changes

  • utils/print.hpp: Added extern "C" declaration for ft_printf so the C++ compiler resolves it with C linkage against libftprintf.
extern "C"
{
    int ft_printf(const char *format, ...);
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Issues with compiling</issue_title>
<issue_description>The terminal indicated that

In file included from tests/c_test.cpp:10:utils/print.hpp:66:18: error: use of undeclared identifier 'ft_printf' ft_printfRet = ft_printf(s, args...); write(1, &eof, 1);

Need to include this line at the top of print.hpp for the code to work

extern "C" { int ft_printf(const char *format, ...); }</issue_description>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: Tripouille <49202412+Tripouille@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues with compiling due to undeclared identifier Fix: declare ft_printf with extern "C" in print.hpp Mar 14, 2026
Copilot AI requested a review from Tripouille March 14, 2026 05:28
@Tripouille Tripouille marked this pull request as ready for review March 14, 2026 05:34
@Tripouille Tripouille merged commit 243c2f6 into master Mar 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues with compiling

2 participants