User forums > Help
No link with libc function
MichelSimian:
Hi,
I faced a problem with C::B (13.2) for windows. It no more links with standard C functions. Those functions (like printf, ...) are unreferenced. It happened suddenly because one month ago, I was able to compile and link all my projects...
Thus, I uninstalled C::B and installed it from the codeblock-mingw setup for windows (last release from december 17). I created a console application and try to compile it (the default main.c with printf("Hello world")...
It fails, with unreference __main and puts functions. I tried with other projects and noticed that all functions like printf cannot link.
I tried to compile using the same mingw toolchain directly in a bat file. It works...
Usually, C::B links by default without special configuration. What's wrong ?
Thanks
BlueHazzard:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
MichelSimian:
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 :
-------------------
--- Code: ---||=== 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)) ===|
--- End code ---
Build log :
------------
--- Code: ----------------- 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))
--- End code ---
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
BlueHazzard:
please make a rebuild and post the build log:
Build->Clean
Build->Build
or
Build->Rebuild
what is your main signature?
BlueHazzard:
Why do you use ld to link and not g++?
Have you changed the compiler settings?
Check in Settings->Compiler->Toolchain executables->Linker for dynamic libs
There should be
--- Code: ---mingw32-g++.exe
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version