Jump to content

  • Log In with Google      Sign In   
  • Create Account


linking SDL in 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
12 replies to this topic

#1 subflood   Members   -  Reputation: 170

Like
0Likes
Like

Posted 03 June 2005 - 02:08 PM

Hello, I just download Visual C++ 2005 Express Edition Beta. I'm not sure how to setup the linker for SDL and OpenGL. Anyone have experiance with this product?

Sponsor:

#2 Undergamer   Members   -  Reputation: 142

Like
0Likes
Like

Posted 03 June 2005 - 02:12 PM

In the older versions of visual studio (specifically VS.NET 2003) you would do this.


Click: Tools->Options
Select: Projects->VC++ Directories
Add an entry for the SDL installation location (add for src, lib, header dirs etc..)

Now after you create your project:
Right click your project icon (after you open it in the right hand scrollable box) and select properties.

Select the tab called "Librarian" or "Linker" and add an entry for your specific SDL dll file (usualy the dll name + ".lib") in the "Additional Dependancies" box.


Now you can include SDL specific headers and call on them without getting link errors.

g/l

#3 subflood   Members   -  Reputation: 170

Like
0Likes
Like

Posted 03 June 2005 - 04:23 PM

Now I'm getting:

main.obj : error LNK2005: _SDL_main already defined in game.obj
LINK : fatal error LNK1104: cannot open file 'uuid.lib'

#4 DevLiquidKnight   Members   -  Reputation: 834

Like
0Likes
Like

Posted 03 June 2005 - 06:48 PM

Quote:
main.obj : error LNK2005: _SDL_main already defined in game.obj
LINK : fatal error LNK1104: cannot open file 'uuid.lib'


LINK : fatal error LNK1104: cannot open file 'uuid.lib'
This means your compiler cant find/open uuid.lib.

Already defined means you don't have your files correctly setup and its getting redefined or something. Most likely its defined in game.cpp or whatever object that points to.

#5 Yamian   Members   -  Reputation: 100

Like
0Likes
Like

Posted 08 June 2005 - 05:48 AM

Guys, it's Beta. I had the same issues. I think SDL just doesn't work under VC8 yet. But in the future it'll be great. Like You can download custom templates and packs, like Dev-C++, but under the wide spread usability of VC. I only got VC7 becasue SDL_gfx had problems with Mingw and ahted it at first becasue I was hooked on DevPaks.

#6 Drew_Benton   Crossbones+   -  Reputation: 1713

Like
0Likes
Like

Posted 08 June 2005 - 06:34 AM

1. Download SDL 1.2.8 and extract it to a location for it to stay in. (C:\Program Files\SDL 1.2.8).

2. Since VC++ is still beta, you are not able to set directories yet. Instead, you must include the header file from the complete path:
#include "C:\\Program Files\\SDL-1.2.8\\include\\SDL.h"
3. Now since you can't set directories and you need to add in library files, you must add those library files to the project. Right click on your project in the 'Solution Explorer' and choose "Add->Existing Item..." Now navigate to the /lib folder for SDL and add in the the SDL.lib and SDLMain.lib. Hit No on the new dialog, or if you hit Yes, then hit cancel.

4. Now go to "Project->Properties", "Linker->Input", and type in "uuid.lib" in the field that says "Ignore Specific Library".

5. Copy the SDL.DLL into your Debug/Release folders so it can be found when you run it. Everything should work fine now. Here's my code that I made for this test:

#include "C:\\Program Files\\SDL-1.2.8\\include\\SDL.h"

Uint8 *g_Keys = 0;

bool g_Done = 0;

int g_Width = 640;
int g_Height = 480;
int g_BPP = 32;

int g_Flags = SDL_DOUBLEBUF | SDL_HWSURFACE;

SDL_Surface* g_Screen;

SDL_Rect Dest;

bool Initialize()
{
Dest.x = 300;
Dest.y = 200;
Dest.w = 100;
Dest.h = 100;

return true;
}

void ProcessEvents( SDL_Event &event )
{
if ( event.type == SDL_QUIT )
g_Done = 1;
}

void Update()
{
g_Keys = SDL_GetKeyState( 0 );

if( g_Keys[ SDLK_ESCAPE ] )
{
g_Done = 1;
}
}

void Draw()
{
SDL_FillRect( g_Screen, &Dest, 0x00FF00 );
}

void Deinitialize()
{
}

int main(int argc, char *argv[])
{
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
printf("Unable to init SDL: %s\n", SDL_GetError());
return -1;
}
atexit(SDL_Quit);

if( !Initialize() )
{
return -1;
}

if ( NULL == SDL_SetVideoMode( g_Width, g_Height, g_BPP, g_Flags ) )
return -1;

g_Screen = SDL_GetVideoSurface();

while( g_Done == false )
{
SDL_Event event;
while ( SDL_PollEvent(&event) )
{
ProcessEvents( event );
}

SDL_FillRect( g_Screen, NULL, 0x000000 );

Update();
Draw();

SDL_Flip( g_Screen );
}

Deinitialize();
SDL_Quit();
return 0;
}







If anyone needs any help with what's been gone over feel free to ask [wink]. Good luck!

#7 Yamian   Members   -  Reputation: 100

Like
0Likes
Like

Posted 08 June 2005 - 11:29 AM

how'd u figure out that uuid.lib thing, the rest seems obvious.

edit: nvrnmd, in errors. When I was trying, I tried to do it the same way they say to do the Platform SDK

#8 neodingo   Members   -  Reputation: 103

Like
0Likes
Like

Posted 09 June 2005 - 02:44 AM

Visual C++ 2005 Beta 2 works just fine with setting directories up, its under Tools | Options...

and then the Projects and Solutions item on the left, VC++ Directories, as for linking you just need to goto project options, the linker, then input, and add SDL.lib and SDLmain.lib to the additional dependies box.

#9 Drew_Benton   Crossbones+   -  Reputation: 1713

Like
0Likes
Like

Posted 09 June 2005 - 06:56 PM

Quote:
Original post by neodingo
Visual C++ 2005 Beta 2 works just fine with setting directories up, its under Tools | Options...


The OP and I are using the express ediitons [wink] I checked back here to post this quote for anyone else using the express edition on how to fix this:

Quote:
Note: For Beta 2, you cannot set the Visual C++ Directories in the Options dialog of Visual C++ Express Edition. To work around this issue, you can update the Visual C++ Directories by modifying the VCProjectEngine.dll.express.config file located in the \vc\vcpackages subdirectory of the Visual C++ Express Edition install location. Please make sure that you also delete the file "vccomponents.dat" located in the "%USERPROFILE%\Local Settings\Application Data\Microsoft\VCExpress\8.0" if it exists before restarting Visual C++ Express Edition.


#10 Yamian   Members   -  Reputation: 100

Like
0Likes
Like

Posted 10 June 2005 - 01:22 AM

Quote:
Original post by Yamian
I tried to do it the same way they say to do the Platform SDK


I did that VCProjectEngine.dll.express.config with SDL and it didn't seem to work...

#11 Drew_Benton   Crossbones+   -  Reputation: 1713

Like
0Likes
Like

Posted 10 June 2005 - 02:04 PM

Yea I have tried it out last night and it did not work for me either. The only fix I can find is to add those paths to each project though the project settings. You will have to add in the header paths manually to the 'Additional Include Directories' under Project->Properties->C/C++->General then do the same for the Additional Library Directories under Linker->Input. Beta products...[headshake] Oh well, it's well worth it [wink]

#12 Maroko   Members   -  Reputation: 122

Like
0Likes
Like

Posted 15 June 2005 - 05:33 AM

Just copy uuid.lib to C:\Program Files\Microsoft Visual Studio 8\VC\lib. It should work.

#13 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 19 June 2005 - 10:26 AM

Hey guys I tried the thing where you ignore uuid.lib - that is pretty good stuff since finally I can compile + link using the VC 2005 BETA 2. I also ignore some other lib called libcd.lib. Hopefully it does not do much although I notice strange behaviour using glui over opengl (the graphics stop when I move the mouse off the little glui window) - yes unfortunately I am not aware of the SDL - but your discussion at least solved one of my problems - cheers.




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