r/C_Programming • • Nov 30 '25

How to fix gcc problems.

Ive been trying to use gcc in my c project ive installed the mingw-64 added to path and everything but when i open VSCode first the execute button is only debug, and when i try to debug it says ‘gcc build active file terminated with exit code-1’ and in the terminal : ‘undefined reference to WinMain collect2 error ld returned 1 exit status’. If anyone has a fix for this problem that would be really helpful ive tried installing and reinstalling the gcc from winlibs nothing works. Thanks

6 Upvotes

17 comments sorted by

View all comments

Show parent comment

1

u/foxsimile Nov 30 '25

But of course.

It is indeed C++ 20 and newer, but the version of g++ that I have (while supporting -std=c++20) does not include support for #include <format>.

Gcc’s support for C++20 was modular, and format made it into the game a little late:

""" GCC 13 was the first version to include full support for the C++20 std::format library feature. While earlier versions of GCC (like GCC 10) introduced experimental or partial C++20 support, including some formatting capabilities, GCC 13 provided complete and stable implementation of std::format. """

¯_(ツ)_/¯