Author Topic: compiler error  (Read 5771 times)

konstandi

  • Guest
compiler error
« 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? :(

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: compiler error
« Reply #1 on: November 09, 2006, 08:03:20 am »
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
« Last Edit: November 10, 2006, 05:27:24 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

konstandi

  • Guest
Re: compiler error
« Reply #2 on: November 10, 2006, 03:26:05 am »
Thks~ the problem still happen , is there any way to resolve it :(

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: compiler error
« Reply #3 on: November 10, 2006, 04:57:49 am »
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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: compiler error
« Reply #4 on: November 10, 2006, 05:02:38 am »
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

 
« Last Edit: November 10, 2006, 05:30:33 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

konstandi

  • Guest
Re: compiler error
« Reply #5 on: November 11, 2006, 09:50:28 am »
thanks! 8)