Sign in to follow this  
PATrainwreck

SDL

Recommended Posts

I'm learning how to use SDL and I want to know how everything works. (I'm using Visual c++ express edition 2008) I don't know what this does: #ifdef WIN32 #pragma comment(lib, "SDL.lib") #pragma comment(lib, "SDLmain.lib") #endif all I know is that my program won't compile with out it (I get linker errors). So what does it do? thanks for any help.

Share this post


Link to post
Share on other sites
That code is linking your project to the library files for SDL which is necessary for any project using SDL. Alternatively, you could go to the project properties menu and under the linker tab add SDL.lib and SDLmain.lib in the additional dependencies field.

Share this post


Link to post
Share on other sites
I'm guessing the code you're compiling is designed to work with different compilers, and maybe even different Operating Systems.

Share this post


Link to post
Share on other sites
Quote:
Original post by bschneid
That code is linking your project to the library files for SDL which is necessary for any project using SDL. Alternatively, you could go to the project properties menu and under the linker tab add SDL.lib and SDLmain.lib in the additional dependencies field.

Yup it's pretty much a MS specific hack that saves you the hassle of having to manually go into the project properties and linking manually.
So, acutally it will compile without that code if you know what you are doing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this