User forums > Using Code::Blocks

[Fixed]I could compile it in MS VC++6.0 while failed in codeblocks

<< < (2/2)

YZMSQ:
Hi,now I can compile it using "g++ naoxi.cpp -mwindows" successfully(the option -mwindows really makes differences ) from command line in cmd.exe,however,I still fail to build it even if "-mwindows"has been given.Do I do anything wrong? :P

build log:


--- Code: ---mingw32-g++.exe -march=i686 -fexec-charset=GBK -mwindows    -c "C:\Documents and Settings\Administrator\naoxi.cpp" -o "C:\Documents and Settings\Administrator\naoxi.o"
mingw32-g++.exe  -o "C:\Documents and Settings\Administrator\naoxi.exe" "C:\Documents and Settings\Administrator\naoxi.o"  
C:\Documents and Settings\Administrator\naoxi.o:naoxi.cpp:(.text+0x8f): undefined reference to `GetStockObject@4'
C:\Documents and Settings\Administrator\naoxi.o:naoxi.cpp:(.text+0x226): undefined reference to `SetTextColor@8'
C:\Documents and Settings\Administrator\naoxi.o:naoxi.cpp:(.text+0x23b): undefined reference to `GetTextMetricsA@8'
--- End code ---

Jenna:
Are you sure you have only one MinGW installation in your system ?
If not it can make a difference.

You use g++.exe on commandline and mingw32-g++.exe inside C::B, that should be the same files (or more exactly one is a copy of the other), please make sure, that this is the case.

YZMSQ:
As you know,I installed the C::B with mingw included at first,and later,I installed TDM as you introduced in C:\MinGW :)   In addition,I changed the "compiler's installation directory"in [compiler and debugger] to C:\MinGW.I also added "-mwindows" and "-fexec-charset=GBK"in "compiler settings"->"other options".  That's all what I did. :D
So,did I do anything unreasonable? :(

YZMSQ:
Hi,there:
It's solved.Adding "-mwindows" in [Global compile settings]->[linker settings]->[other linker options] will make great differences. :D
Thank you for your selfless help. :D

Navigation

[0] Message Index

[*] Previous page

Go to full version