Author Topic: CodeBlocks, VC-Tools2003 and SDL  (Read 13930 times)

atom

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« on: March 08, 2005, 08:54:35 pm »
hi,
i was quite happy to find an ide like codeblocks and was desperate to do some little project, just to use it. i am embarrassed to admit: i can't get it to compile and link!

i had various error messages, ranging between "unresolved symbol" and "missing entry point" and i'm totally lost. can anybody help me and document a setup for this on windows?


thanks a lot in advance!
atom

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
CodeBlocks, VC-Tools2003 and SDL
« Reply #1 on: March 08, 2005, 11:06:43 pm »
For installation info look at the wiki, under "Articles".
If you 're still having problems, don't be afraid to ask here. Just be more specific...

Yiannis.
Be patient!
This bug will be fixed soon...

Anonymous

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« Reply #2 on: March 10, 2005, 06:28:19 am »
I'll post to this thread, as it seems to be almost the same, and the 'Articles' do not yet address this issue.  I've installed VC-Tools 2003, WinXP SDK, and Code::Blocks 1.0 Beta 5.  Created new 'Win32 GUI Application" in Code::Blocks, and did not modify the auto-generated code.  Pointed the 'Project' -> 'Build Options' -> 'Compiler dirs' to the SDK include subdirectory, and the 'Project' -> 'Build Options' -> 'Linker dirs' to the SDK Lib subdirectory.  Upon pressing compile, get the following errors:

Linking executable: D:\Temp\Test.exe
LINK : warning LNK4044: unrecognized option '/lstdc++'; ignored
LINK : warning LNK4044: unrecognized option '/lgcc'; ignored
LINK : warning LNK4044: unrecognized option '/lgdi32'; ignored
LINK : warning LNK4044: unrecognized option '/lcomdlg32'; ignored
LINK : warning LNK4044: unrecognized option '/lodbc32'; ignored
LINK : warning LNK4044: unrecognized option '/lwsock32'; ignored
LINK : warning LNK4044: unrecognized option '/lwinspool'; ignored
LINK : warning LNK4044: unrecognized option '/lwinmm'; ignored
LINK : warning LNK4044: unrecognized option '/lshell32'; ignored
LINK : warning LNK4044: unrecognized option '/lcomctl32'; ignored
LINK : warning LNK4044: unrecognized option '/lctl3d32'; ignored
LINK : warning LNK4044: unrecognized option '/ladvapi32'; ignored
LINK : warning LNK4044: unrecognized option '/lopengl32'; ignored
LINK : warning LNK4044: unrecognized option '/lglu32'; ignored
LINK : warning LNK4044: unrecognized option '/lole32'; ignored
LINK : warning LNK4044: unrecognized option '/loleaut32'; ignored
LINK : warning LNK4044: unrecognized option '/luuid'; ignored
main.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__GetMessageA@16 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)
D:\\Temp\\Test.exe : fatal error LNK1120: 10 unresolved externals
Process terminated with status 1 (0 minutes, 0 seconds)
11 errors, 0 warnings

I got rid of the "This is a custom Makefile" checkmark in the project Properties box.  (Also tried it with it checked.  Same problem.)

What is the next step?

Oh - and now the 'Project' -> 'Build Options' menu item won't bring up the options window...
(Maybe it never did, but I thought it did.  I can get what I believe is the right window by clicking on 'Project' -> 'Properties' -> 'Targets' tab, and then clicking on the 'Target's Build Options' button.)

Thanks,
David

Anonymous

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« Reply #3 on: March 10, 2005, 06:49:56 am »
I just found an answer in another thread ("Lib files not found with VC++ Toolkit") - Seems to have fixed most of it.  The program compiles and runs, although I still get the following warnings when I press the compile button:

Calculating dependencies: main.cpp
Switching to target: default
main.cpp
Linking executable: test.exe
LINK : warning LNK4044: unrecognized option '/lstdc++'; ignored
LINK : warning LNK4044: unrecognized option '/lgcc'; ignored
LINK : warning LNK4044: unrecognized option '/lgdi32'; ignored
LINK : warning LNK4044: unrecognized option '/lcomdlg32'; ignored
LINK : warning LNK4044: unrecognized option '/lodbc32'; ignored
LINK : warning LNK4044: unrecognized option '/lwsock32'; ignored
LINK : warning LNK4044: unrecognized option '/lwinspool'; ignored
LINK : warning LNK4044: unrecognized option '/lwinmm'; ignored
LINK : warning LNK4044: unrecognized option '/lshell32'; ignored
LINK : warning LNK4044: unrecognized option '/lcomctl32'; ignored
LINK : warning LNK4044: unrecognized option '/lctl3d32'; ignored
LINK : warning LNK4044: unrecognized option '/ladvapi32'; ignored
LINK : warning LNK4044: unrecognized option '/lopengl32'; ignored
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

What do I need to do to get rid of these?  (Edit the .cpb file manually?  Where are they coming from in Code::Blocks?  I can't find them except in the .cpb.)

Thanks,
David

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
CodeBlocks, VC-Tools2003 and SDL
« Reply #4 on: March 10, 2005, 09:24:07 am »
Quote
Oh - and now the 'Project' -> 'Build Options' menu item won't bring up the options window...
(Maybe it never did, but I thought it did. I can get what I believe is the right window by clicking on 'Project' -> 'Properties' -> 'Targets' tab, and then clicking on the 'Target's Build Options' button.)

This is a known bug in beta5. You first have to select the project in the tree and then the menu "Project/Build options" will work. Alternatively, right-click the project in the tree and select "Build options"...

In the build options window, go to the linker options tab and remove the "/l" from the above options that give you errors (you might as well append ".lib" to each of the above).

HTH,
Yiannis.
Be patient!
This bug will be fixed soon...

atom

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« Reply #5 on: March 10, 2005, 10:49:51 am »
Sorry, that I'm not very specific. The problem is, that I'm not very experienced with compiler setups in C. I try to explain some more and maybe I will have some time later on, to retry with the info from the other thread.

Goal:
I would like to use SDL in a project and thus have to include "SDL.h". SDL itself is a .dll.

Way so far:
Installing VST2003 and the newest beta of codeblocks is no problem. I was able to compile and run the minimal "console application" code from within codeblocks.
I added the "SDL.h" to the code, added the include-dir to compiler dirs and library-dir to the linker-dirs.
I did not install the additional "windows-kit", though I'm not so shure anymore if SDL won't make use of windows-gui?

Problem:
Now, I don't know what to do next? Do I have to add the library-files to the project, or just enter them in linker-options? And if so, what exactly do I enter there?


atom

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
CodeBlocks, VC-Tools2003 and SDL
« Reply #6 on: March 10, 2005, 12:42:08 pm »
Unfortunately, to build any program making use of the Windows API (SDL is one of them) using the MS VC Toolkit, you will have to download and install the MS Platform SDK. It's a hefty download, minimum of 100+ MB and full is around 300+ MB, if I recall correctly...
Or, you can order a free (I think) CD from Microsoft.

Your other option is to use another compiler, like MinGW, which contains the Windows API headers and libraries.

Anyway, after your setup is OK, you will have to add the SDL libs in the linker options. For MinGW add "-lSDL_main -lSDL" and for MS VC Toolkit add "SDL_main.lib SDL.lib" (I haven't tried that!).

HTH,
Yiannis.
Be patient!
This bug will be fixed soon...

atom

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« Reply #7 on: March 10, 2005, 12:49:18 pm »
Thanks. It seems, that mingW is the better choice then. I will give it a try soon and post my results.

Anonymous

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« Reply #8 on: March 10, 2005, 04:56:13 pm »
Quote from: mandrav
...In the build options window, go to the linker options tab and remove the "/l" from the above options that give you errors (you might as well append ".lib" to each of the above).


You have another slight bug in that linker tab text box.  With the following items in it:

-lstdc++
-lgcc
-lgdi32
-lcomdlg32
-lodbc32
-lwsock32
-lwinspool
-lwinmm
-lshell32
-lcomctl32
-lctl3d32
-ladvapi32
-lopengl32
user32.lib

the text box somehow auto-scrolls down so that only the user32.lib is showing.  A quick glance only shows user32.lib, and a not-so-quick glance shows the same thing.  But when you click on the scrollbar (which is sized and positioned incorrectly for this scroll position), all of them appear except the user32.lib, which is hidden under the bottom.

All in all, I am _very_ impressed!  You have done a lot of work on this, and it is a pretty cool tool.  Thanks!

David

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
CodeBlocks, VC-Tools2003 and SDL
« Reply #9 on: March 10, 2005, 05:22:58 pm »
Quote
the text box somehow auto-scrolls down so that only the user32.lib is showing

Yes, this I believe is a bug in wxWidgets. I can't make anything to make the text box show the contents correctly  :(
It also happens in all other text boxes in that window.

I 've not given up on it yet, though ;)

Yiannis.
Be patient!
This bug will be fixed soon...

atom

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« Reply #10 on: March 10, 2005, 10:55:12 pm »
Ok, I said I will give it another try and guess what: finally it worked!! I feel, like I'm not too stupid after all  ;)

In the end, it's no big deal - if you use MinGW. Like I guessed before, you have to add "lib" and "include" dirs to "linker dirs" and "compiler dirs" in the project's build options. One other problem emerged, when I encountered this failure: "undefined reference to `WinMain@16". I found out "-lmingw32" was missing in the "linker options", which look now this way:

-lmingw32
-lSDLmain
-lSDL

I wonder why minggw32 must be added by hand - I used a setup for windows console after all, when starting a codeblocks project. Is this only needed in certain projects?


However - now it is working and I enjoy the sweet IDE  :)
Thanks for the help and good work!


atom

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
CodeBlocks, VC-Tools2003 and SDL
« Reply #11 on: April 09, 2005, 02:08:07 am »
How did you create that project? Can you post a step by step guide into reproducing this issue?

If you can reproduce the problem, please report the bug in Sourceforge: "Project blablah misses library" or something.

Anonymous

  • Guest
CodeBlocks, VC-Tools2003 and SDL
« Reply #12 on: July 03, 2005, 11:08:14 pm »
I success to build an SDL application with Toolkit 2003, but i have lot of link errors when i am trying to use STL map container. SDL.lib is multithreaded library and i can't link msvcrt.lib (from .Net SDK 1.1) witth an application using maps. Someone has an idea ?