Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: konstandi on November 09, 2006, 05:23:44 am
-
C:\Screen\codeblock\MULTI2.o:MULTI2.C:(.text+0x2a9): undefined reference to `TextOutA@20'
C:\Screen\codeblock\MULTI2.o:MULTI2.C:(.text+0x86a): undefined reference to `Ellipse@20'
it is a win32 program . google it, someone say can use -mwindows compiler flags to fixup this error if use mingw. where did i set this parameter ? but i found it seemed have be append in code::block.
how can i fixup this error? :(
-
Try
"Projects" -> "Build Options" Tab "Linker" Tab "Other Linker Options" and add -mwindows in window
Corrected above should have been "Linker" Tab NOT "Compiler" Tab, but it appears that the proper way to add -mwindows is stated in my message below.
Tim S
-
Thks~ the problem still happen , is there any way to resolve it :(
-
Try doing this and tell me what you get.
"Setting" -> "Global Compiler settings" Tab "compiler" Tab "Other" Set "compiler logging" to "Full command line"
Here's what I got as output it may or may not look like yours.
mingw32-gcc.exe -Wall -O2 -IC:\apps\MinGW_GCC_3.4.5\include -c MULTI2.C -o obj\Release\MULTI2.o
mingw32-g++.exe -LC:\apps\MinGW_GCC_3.4.5\lib -o bin\Release\test.exe obj\Release\MULTI2.o -s -mwindows
Note: I did NOT have to add the -mwindows manually; I used the wizard to create an Win32 GUI Project and it works in release mode OK, but I get the same errors you are getting if I try to compile it in debug mode.
Verify the build target. And, if you still have problems post the Full command line results.
Note: I hope this is NOT homework, I found the code you are compiling on a school website.
Debug mode sometimes requires library that are not on most computers, if you need to do debug mode more research is needed to find debug versions of files/libraries etc.
Tim S
-
I though the -mwindows option is added/removed in C::B by setting "Build Target Options"
Edit: But, testing seems to show that is does NOT always add/remove it still looking for cause; the cause it was user error, changing setting on wrong project.
The error you get happens if library gdi32 is not used, but when flag -mwindows is used it can work without library gdi32 sometimes, maybe all the time.
"Project" -> "Properties" Tab "Targets" select target to be changed; pick "GUI Application" to add flag -mwindows
Verify you are linking libs:
gdi32
"Project" -> "Build Options" Select correct target or project name in left window
Tab "Linker" Window "Link Libraries" Add gdi32
Tim S
-
thanks! 8)