Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Setting up SDL for Visual C++ 2005


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 mcgraw   Members   -  Reputation: 560

Like
0Likes
Like

Posted 11 July 2005 - 08:30 PM

Gamedevers, Hey fellas, I am having a rough time making sure that im setting SDL up correctly for Visual C++ 2005 'Beta' edition. I copied the two *.lib files to my windows\system32 directory. I copied the two *.lib files to C:\Program Files\Microsoft Visual Studio 8\VC\lib I copied the header files to C:\Program Files\Microsoft Visual Studio 8\VC\include\SDL From what I Imagine is correct... I found that you need to actually let the software know about these two files, so I started a new project and looked around in the settings a bit. I found that if you go to the properties page, and down to Linker>>Input, you find "Additional Dependencies". Is that the correct place to put in sdl.lib and sdlmain.lib? When I attempt to do a quick compile of: #include <SDL/SDL.h> #include <iostream> using namespace std; int main() { return 0; } It gives me this error: Linking... LINK : fatal error LNK1104: cannot open file 'uuid.lib' Thanks for the help in advance.

Sponsor:

#2 snk_kid   Members   -  Reputation: 1312

Like
0Likes
Like

Posted 11 July 2005 - 09:32 PM

Copying static libraries into system32 folder is unnecessary, its DLLs that can go in there.

Anyways it appears you need the MS Platform SDK (required for win32 apps).

Once you've obtained that you must follow these instructions.

After which

create a project, then set-up the project settings for SDL:

C/C++ --> General --> Additional Include Directories = < insert sdl include directory >

Linker --> General --> Additional Library Directoires = < insert sdl library directory >

Linker --> Input --> Additional Dependencies = SDLmain.lib SDL.lib

You can also setup SDL include/library directories to be always set like you do for the platform sdk given in the instructions at the link above.

#3 vEEcEE   Members   -  Reputation: 175

Like
0Likes
Like

Posted 11 July 2005 - 10:03 PM

Your system32 directory isn't the place to put lib files I don't think, and I wouldn't really put 'em in visual studio's directory either. Personally, I have mine in the program files directory, like this:

"c:\Program Files\SDL\include\"
"c:\Program Files\SDL\lib"


Then in Visual Studio 2005, you need to go to the Tools>Options menu, and under Projects and Solutions>VC++ Directories, you add those two directories...

Set Include Files to "c:\Program Files\SDL\include\" and
set Library files to "c:\Program Files\SDL\lib".

If you actually meant that you're using Visual C++ 2005 Express Edition (Beta 2), then there's a bug where doing the above isn't possible...it doesn't offer a way to set the directory in the options. What you need to do instead is to edit a text file. Assuming you installed VC++ Express to Program Files, you need to edit this file:

"c:\Program Files\Microsoft Visual Studio 8\VC\vcpackages\VCProjectEngine.Dll.Express.Config"

and when you're done editing that file, you need to DELETE the file below or your changes won't work:

"c:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\VCExpress\8.0\VCComponents.dat"

You may need to change "Administrator" in that path to whatever your login name is. Once you've edited the file and deleted that .dat file, you have to restart Visual C++.

Editing the VCProjectEngine.Dll.Express.Config file should be easy enough to figure out, but just in case...I'll show you a section of mine where I've added SDL, DirectX 9.0c, and the Platform SDK:

<Directories
Include="c:\Program Files\SDL\include;c:\Program Files\Microsoft DirectX 9.0c SDK (June 2005)\Include;c:\Program Files\Microsoft Platform SDK\Include;$(VCInstallDir)include;$(VCInstallDir)PlatformSDK\include;$(FrameworkSDKDir)include"
Library="c:\Program Files\SDL\lib;c:\Program Files\Microsoft DirectX 9.0c SDK (June 2005)\Lib\x86;c:\Program Files\Microsoft Platform SDK\Lib;$(VCInstallDir)lib;$(VCInstallDir)PlatformSDK\lib;$(FrameworkSDKDir)lib;$(VSInstallDir);$(VSInstallDir)lib"
Path="c:\Program Files\Microsoft Platform SDK\Bin;$(VCInstallDir)bin;$(VCInstallDir)PlatformSDK\bin;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)bin;$(FrameworkDir)$(FrameworkVersion);$(VSInstallDir);$(PATH)"
Reference="$(FrameworkDir)$(FrameworkVersion)"
Source="c:\Program Files\Microsoft Platform SDK\src\crt;$(VCInstallDir)crt\src"
/>


Once again, remember to delete VCComponents.dat when you're done editing!

As for the linker error that you got, I'd say its because either you haven't installed the Platform SDK, or you haven't set up the paths to the include and lib files for it. uuid.lib is from that Platform SDK. Check out this FAQ on how to install it for Visual C++ 2005 Express.

http://lab.msdn.microsoft.com/express/visualc/usingpsdk/default.aspx



There's a little bit more to getting SDL working, but this reply is already getting quite long, so I'll just quickly tell you. In your project's settings, you need to change the Runtime Library to Multi-threaded DLL which should be under C/C++>Code Generation. And if I remember right, for SDL, you can't just use "int main()", you need to add the parameters for the command line arguments, like this:

int main(int argc, char *argv[])

Then of course you need to add sdl.lib sdlmain.lib to the Additional Dependencies section of the Linker settings.

I actually made a project wizard to setup an SDL project automatically, 'cause it's quite a bit of work. Unfortunitly I have released it, but maybe I will someday. oh well...I'll bookmark this thread in case you need any other help. Good luck.


#4 Oberon_Command   Crossbones+   -  Reputation: 1939

Like
0Likes
Like

Posted 12 July 2005 - 08:24 AM

One problem with some of the above methods: in VC 2005, you can't set additional include directories! Oh, and you don't need the Platform SDK to compile (at least I don't). Here's how I did it: copy the include/lib files to their proper directories in the installation, then in the project properties dialog, go to Configuration Properties->Input and add in sdlmain.lib and sdl.lib in the Additional Dependencies and add uuid.lib to the Ignore Specific Library field. Then, go to the C/C++ tree and select Code Generation, and change the Runtime Library to Multithreaded DLL.

That should work out for ya.

#5 mcgraw   Members   -  Reputation: 560

Like
0Likes
Like

Posted 12 July 2005 - 09:53 AM

Gamedevers,

I want to thank you all for your prompt response to this issue.

It's fixed, and I am now working through some tutorials from http://sol.planet-d.net/gp/index.html

This is what I didn't do (for future reference)
¤ Change Runtime Library to 'Multithreaded DLL'
¤ Ignore Specific Library -> 'uuid.lib'
¤ Placing SDL.DLL within the Visual Studio 8 Directory

Thanks for the help everybody!


#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 25 July 2006 - 09:40 AM

i can get it to work on Visual C++ 2005!

i keep on getting this error message:

------ Build started: Project: vtest, Configuration: Debug Win32 ------
Linking...
LINK : fatal error LNK1561: entry point must be defined
Build log was saved at "file://c:\Documents and Settings\Alan\Desktop\vtest\vtest\Debug\BuildLog.htm"
vtest - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


#7 GeoMX   Members   -  Reputation: 134

Like
0Likes
Like

Posted 25 July 2006 - 11:22 AM

Check here: SDL:Tutorials:Setup

Regards.

#8 n00body   Members   -  Reputation: 275

Like
0Likes
Like

Posted 29 January 2007 - 03:29 AM

When I try to use SDL_opengl.h, it keeps saying that "cannot open windows.h". I assumed that the windows SDK would fix that, but it still doesn't work. What am I missing?

#9 Ra   Members   -  Reputation: 1062

Like
0Likes
Like

Posted 29 January 2007 - 04:15 AM

Quote:
Original post by n00body
When I try to use SDL_opengl.h, it keeps saying that "cannot open windows.h". I assumed that the windows SDK would fix that, but it still doesn't work. What am I missing?


It sounds like you didn't install the SDK properly. Try making a blank project and including <windows.h>, and it should fail. The header search paths probably just need to be set up properly.

#10 v3n0w   Members   -  Reputation: 122

Like
0Likes
Like

Posted 13 March 2007 - 09:01 AM

"Compiling...
SDL_teste.cpp
Linking...
LINK : fatal error LNK1561: entry point must be defined"

#include "SDL.h"   /* Todas as aplicações SDL precisam deste cabeçalho */
#include <stdio.h>

int main(void) {

printf("Initializing SDL.\n");

/* Inicializa padrões, Vídeo e Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf("Não foi possível inicializar SDL: %s.\n", SDL_GetError());
exit(-1);
}

printf("SDL inicializada.\n");

printf("Terminando SDL.\n");

/* Termina todos os subsistemas */
SDL_Quit();

printf("Terminando....\n");

exit(0);
}


Anyone can help me??

Im with the libs linked, with uuid.lib ignored, with /MD and with no precompiled header.

Thanks!



#11 v3n0w   Members   -  Reputation: 122

Like
0Likes
Like

Posted 13 March 2007 - 09:21 AM

I found the problem....

I have to set the CONSOLE subsystem.

And then, use the main like this: "int main(int argc, char *argv[])"

"int main()" does not work.

;)

#12 TheOther   Members   -  Reputation: 150

Like
0Likes
Like

Posted 18 March 2007 - 04:24 PM

I had a really difficult time with the SDL release and Visual Studio 2005 SP1.

I kept getting really annoying manifest errors when the debugger attempted to use/load the SDL.dll, and I spent too much time trying to track down these errors online.

The only workaround that immidiately fixed up these issues was to build the SDL source in VS2005.

hth,

#13 Atridas   Members   -  Reputation: 151

Like
0Likes
Like

Posted 20 August 2007 - 09:42 AM

Quote:
Original post by n00body
When I try to use SDL_opengl.h, it keeps saying that "cannot open windows.h". I assumed that the windows SDK would fix that, but it still doesn't work. What am I missing?




I've got the same problem. I lloked into the VC/Includes directorie and it's just missing. No "windors.h" file. They aren't GL libraries too, so I think it could be related to the "Express" think (My guess is that in the free relase the just missed many libraries). Does anyone know how to fix it? I'm just trying to move from VC++ 6 to the 2005, but my projects don't work 'cause of that...


Thank you

#14 Lazy Foo   Members   -  Reputation: 1105

Like
0Likes
Like

Posted 20 August 2007 - 01:19 PM

Before using SDL, make sure you have the latest version of Visual Studio with the latest service pack installed and the platform SDK installed and configured.

Learn to make games with my SDL 2 Tutorials


#15 Atridas   Members   -  Reputation: 151

Like
0Likes
Like

Posted 20 August 2007 - 01:37 PM

Well...

first, thanks to lazy foo and his tutorials, which made me learn SDL.

Now that I can run my old project in VC++ 2005, SDL_image seems to have forgot how to load an jpg...

loadedImage = IMG_Load( "Data/secsi.jpg" );

then loadedImage is just NULL u.u

(I'm getting off topic, no? should I open a new thread? xDDDD)

#16 evillive2   Members   -  Reputation: 694

Like
0Likes
Like

Posted 20 August 2007 - 01:51 PM

Quote:
Now that I can run my old project in VC++ 2005, SDL_image seems to have forgot how to load an jpg...

loadedImage = IMG_Load( "Data/secsi.jpg" );

then loadedImage is just NULL u.u

Try moving where the data folder is. The working directory may be different than where you are used to in VS 6.0. Your working directory is by default I think the same as where the source files are. That is where it is for me but I am not sure if I moved anything.

#17 marcus12024   Members   -  Reputation: 162

Like
0Likes
Like

Posted 30 July 2008 - 09:14 AM

Quote:
Original post by Atridas
Well...

first, thanks to lazy foo and his tutorials, which made me learn SDL.

Now that I can run my old project in VC++ 2005, SDL_image seems to have forgot how to load an jpg...

loadedImage = IMG_Load( "Data/secsi.jpg" );

then loadedImage is just NULL u.u

(I'm getting off topic, no? should I open a new thread? xDDDD)


I realize this is an old thread, but I recently had the exact same issue, and found a solution. Chances are you are missing jpeg.dll on your system, which is included as part of the binary download of SDL_image from the SDL_image download page

You either need to include jpeg.dll in the same folder as your executable, or could put it somewhere "visible" to applications on your system, like in the windows\system32 folder.

Hope this helps anyone else that may be encountering the same issue. Sometimes SDL is a little too good at failing gracefully, and in this situation it simply doesn't load in the image...sadly it doesn't return an error code that I can see, or any way to tell that it happened because the jpeg.dll file wasn't found.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS