code blocks linking problem

Sep 30, 2011 at 3:54am
closed account (zwA4jE8b)
I am trying to use code blocks, it looks awesome. My problem is that I have had VS2010 baby me for too long and I cannot figure out how to get my program to run in codeblocks.


I have these in the respective search paths, for compiler and linker.

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\gl
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib\x64


but when I go to build it, none of the windows functions are recognized.

I have searched for a while now.

I am starting with an empty project and just adding all my code files.

I tried creating a windows project, some of my program worked but the input and drawing was messed up.

Any advice?
Sep 30, 2011 at 4:07am
Interesting, i haven't had any issues with linking, other than misunderstandings on my part- what steps are you trying to take and are you actually using libraries?
Sep 30, 2011 at 4:21am
closed account (zwA4jE8b)
well if I just copy all my code files (.cpp and .h) files into a project in code blocks and click build it comes up with a bunch of errors saying it cannot find the symbols .... all of them windows functions.
Sep 30, 2011 at 5:25am
Interesting, I'm assuming you googled the particular errors in regards to mingw? I know that some things are quite different between the compilers.

With the info I've got not a ton I can do to help, if you offer more perhaps I could be of more assistance?
Sep 30, 2011 at 3:10pm
Eh... you did link whichever libraries you're using, didn't you?
Sep 30, 2011 at 3:53pm
closed account (zwA4jE8b)
I switched to trying these in my search directories. because I am use the gcc compiler
C:\MinGW\include
C:\MinGW\lib

There are the errors I get. All windows API stuff.


obj\Debug\gamengine.o||In function `ZN4game10game_init1Ev':|
C:\CODE\C++\2 - Games\Snake\gamengine.cpp|64|undefined reference to `CreateCompatibleDC@4'|
C:\CODE\C++\2 - Games\Snake\gamengine.cpp|65|undefined reference to `CreateCompatibleBitmap@12'|
C:\CODE\C++\2 - Games\Snake\gamengine.cpp|66|undefined reference to `SelectObject@8'|
obj\Debug\gamengine.o||In function `ZN4game8game_endEv':|
C:\CODE\C++\2 - Games\Snake\gamengine.cpp|221|undefined reference to `SelectObject@8'|
C:\CODE\C++\2 - Games\Snake\gamengine.cpp|222|undefined reference to `DeleteObject@4'|
C:\CODE\C++\2 - Games\Snake\gamengine.cpp|223|undefined reference to `DeleteDC@4'|
obj\Debug\gamengine.o||In function `ZN4game9game_blitEP5HDC__':|
C:\CODE\C++\2 - Games\Snake\gamengine.cpp|258|undefined reference to `BitBlt@36'|
obj\Debug\levelengine.o||In function `ZN5level16level_drawinsideERKP5HDC__RKi':|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|53|undefined reference to `SetTextColor@8'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|54|undefined reference to `TextOutA@20'|
obj\Debug\levelengine.o||In function `ZN5level17level_drawoutsideERKP5HDC__RKi':|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|122|undefined reference to `SetTextColor@8'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|123|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|124|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|125|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|126|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|127|undefined reference to `SetTextColor@8'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|128|undefined reference to `TextOutA@20'|
obj\Debug\levelengine.o||In function `ZN5level12level_splashERKP5HDC__RKi':|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|544|undefined reference to `SetTextColor@8'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|545|undefined reference to `TextOutA@20'|
obj\Debug\levelengine.o||In function `ZN5level11level_introERKP5HDC__':|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|551|undefined reference to `SetTextColor@8'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|552|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|553|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|554|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|556|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|557|undefined reference to `TextOutA@20'|
obj\Debug\levelengine.o||In function `ZN5level12level_updateERKP5HDC__RKiS5_':|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|561|undefined reference to `SetTextColor@8'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|564|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|565|undefined reference to `TextOutA@20'|
obj\Debug\levelengine.o||In function `ZN5level9level_endERKP5HDC(short) static':|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|570|undefined reference to `SetTextColor@8'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|573|undefined reference to `TextOutA@20'|
C:\CODE\C++\2 - Games\Snake\levelengine.cpp|575|undefined reference to `TextOutA@20'|
obj\Debug\externvars.o||In function `_static_initialization_and_destruction_0':|
C:\CODE\C++\2 - Games\Snake\externvars.cpp|16|undefined reference to `CreateSolidBrush@4'|
C:\CODE\C++\2 - Games\Snake\externvars.cpp|17|undefined reference to `CreateSolidBrush@4'|
C:\CODE\C++\2 - Games\Snake\externvars.cpp|18|undefined reference to `CreateSolidBrush@4'|
C:\CODE\C++\2 - Games\Snake\externvars.cpp|19|undefined reference to `CreateSolidBrush@4'|
C:\CODE\C++\2 - Games\Snake\externvars.cpp|20|undefined reference to `CreateSolidBrush@4'|
||=== Build finished: 35 errors, 0 warnings ===|
Sep 30, 2011 at 5:10pm
You need to link to gdi32
Sep 30, 2011 at 5:58pm
closed account (zwA4jE8b)
can do, thanks. Do I just add 'gdi32.dll' to the list of additional libraries?
Sep 30, 2011 at 6:16pm
Just go to project->build options->linker settings-> add button (find libgdi32 for your compiler)
Sep 30, 2011 at 6:17pm
closed account (zwA4jE8b)
thanks man.
Sep 30, 2011 at 6:18pm
Any time
Sep 30, 2011 at 10:21pm
goto settings->compiler and debugger->toolchain executibles->Auto-detect

I had a similar problem and this fixed it...
Topic archived. No new replies allowed.