Hi,
I'm using Code::Block version 17.2 on Windows Seven PRO 64bits service pack 1. Compiler is mingw-gcc (tdm-1) 5.1.0 (supplied by the Codeblock installer)
When I create a console-application project, and compile the default main.c supplied, it fails with unresolved reference to __main and puts.
Build messages :
-------------------
||=== Build: Debug in bidon (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\Win7PRO\Documents\bidon\main.c|5|undefined reference to `__main'|
C:\Users\Win7PRO\Documents\bidon\main.c|6|undefined reference to `puts'|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Build log :
------------
-------------- Build: Debug in bidon (compiler: GNU GCC Compiler)---------------
ld.exe -o bin\Debug\bidon.exe obj\Debug\main.o
obj\Debug\main.o: In function `main':
C:/Users/Win7PRO/Documents/bidon/main.c:5: undefined reference to `__main'
C:/Users/Win7PRO/Documents/bidon/main.c:6: undefined reference to `puts'
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
When I compile it in a command line, it works
I already tried to uninstall Code::Block and to reinstall it. It did not fix the problem.
I tried to build a previous project which has lot of sources and lib to link and it failed with the printf, and other "libc" functions.
What is wrong on the installation ?
Thanks
This is the Bluid log after a Build>Clean
-------------- Build: Debug in bidon (compiler: GNU GCC Compiler)---------------
gcc.exe -Wall -g -c C:\Users\Win7PRO\Documents\bidon\main.c -o obj\Debug\main.o
ld.exe -o bin\Debug\bidon.exe obj\Debug\main.o
obj\Debug\main.o: In function `main':
C:/Users/Win7PRO/Documents/bidon/main.c:5: undefined reference to `__main'
C:/Users/Win7PRO/Documents/bidon/main.c:6: undefined reference to `puts'
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
OK, I change the linker in mingw32-g++ as proposed, and it fixes the problem.
See new build with right linker command :
-------------- Build: Debug in bidon (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -o bin\Debug\bidon.exe obj\Debug\main.o
Output file is bin\Debug\bidon.exe with size 28.47 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Thanks a lot :)