# Using SDL with Code::Blocks

This topic is 4600 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I recently downloaded the Code::Blocks IDE. I don't own MS Visual Studio or any other commercial IDE/compiler and I previously used Dev-C++. I really liked Code::Blocks' interface after I tried it and decided to use it instead. I'm trying to learn SDL. :-) I can't get it to work with Code::Blocks though! I went to the SDL website and downloaded the SDL 1.2.8 developement libraries for MingW32, but I can't extract anything from the MingW32 file (I've tried Winzip and WinAce)! I checked the pages for SDL 1.0.8, but they only offer developement libraries for Visual C++. Code::Blocks can use a variety of compilers, so I installed Microsoft Visual C++ Toolkit 2003 and tried copying the files from the SDL 1.2.8 dev. libraries for Visual C++ into the "lib" and "include" directories of the VC++ Toolkit, but now I get strange linker errors. I'm still a C++ novice so any help would be greatly appriciated! Currently I'm receiving the following error after copying SDL 1.0.8 files into the VC++ Toolkit directories and trying to compile with the VC++ Toolkit compiler: File Line Message LINK fatal error LNK1181: cannot open input file 'SDL.obj' What should I do...? By the way, I'm using the SDL project template in Code::Blocks to try to get this to work, so the error probably isn't in the code. [Edited by - GenuineXP on July 17, 2005 7:13:49 PM]

##### Share on other sites
Does code::blocks use the same .a lib files as dev-c++ tried to use them...but I got alot of errors...tried to compile the SDL source in code::blocks too...didn't get it to work, but thats probobly my own fault...

##### Share on other sites
Quote:
 Original post by walleDoes code::blocks use the same .a lib files as dev-c++ tried to use them...but I got alot of errors...tried to compile the SDL source in code::blocks too...didn't get it to work, but thats probobly my own fault...

Code::Blocks can use the mingw32 toolchain, which is what dev-cpp comes with. Make sure that the .lib/.a files are in a directory accessible to mingw32 (lib directory) and that you are instructing the linker to use them.

In project build options, "other linker options" you should have the following options listed in this order:

-lmingw32-lsdlmain-lsdl... Additional SDL libraries can go here ...-mwindows

##### Share on other sites
Thank you very much!!

##### Share on other sites
Thanks for the replies, but I'm still having trouble.

For one thing, I'm trying to use the Visual C++ Toolkit to compile the project. I'd like to use Mingw32 (which was installed with Code::Blocks), but I can't seem to extract any files from the file on the SDL website (the SDL 1.2.8 developement library for Mingw32)! :-(

Does anyone have a copy of the necessary SDL include and library files for Mingw32? If so, could someone maybe compress them in a ZIP file and send them to me? Is there another location where I can download them?

Thank you again.

##### Share on other sites
You've used Dev C++? Have you downloaded the Dev Packs for SDL? If not, I believe you can find them off SourceForge.net.

Anyways, the Dev Packs are just a ".tar.gz" file I believe, so if you rename the devpack extension to ".tar.gz", so should be able to extract it with WinRAR, WinZip, or Izarc (free). From there, just copy locate the ".a" files (those are the lib files) to your Code::Blocks /lib directory and link to them in Code::Blocks.

When I used Code::Blocks that's how I got the library files for SDL. They're not on my system anymore or I would email them to you.