-1

I'm new to C and I'm trying to compile a HelloWorld program. I'm using GNU GCC 4.9.2. I've looked online for many solutions but none of them worked: Every time I compile the program, it hits me with this error:

"Undefined reference to 'WinMain@16'"

Please bear in mind that I HAVE configured the project as a console project, not a windows project and that I have written the main function correctly.

Here's the code:

#include <stdio.h>

int main()
{
    printf("Hello world!\n");
    return 0;
}

Finally, note that I can successfully compile, build, and run C++ programs with code blocks. For some reason, I can't do the same for C. Additionally, I tried compiling the source file from the command line and the issue still persisted.

Compilation lines:

enter image description here

Saif Taher
  • 325
  • 1
  • 12

1 Answers1

-1

I solved the problem and I don't know how. I changed the C debugger from gcc to gnu, it gave me a different error. I then changed it back to gcc and it started working randomly. I've been trying to solve this problem for literally 6 hours. Then I try some random nonsense and guess what? it works.

I hate software development.

I love software development.

Saif Taher
  • 325
  • 1
  • 12