including SDL into a program

Started by
10 comments, last by Rob Loach 18 years, 4 months ago
I have compiler options to check the folder "SDL/include" for the include files and "SDL/lib" for the lib files. then i explicitly include the library in the code by doing #pragma comment(lib, "sdl.lib"), but when i run the program it's saying that it's missing "sdl.dll", how do i link that or however i need to add that?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Advertisement
sdl.dll needs to be in same place as your .exe or in windows\system32.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
The lib files only exists to tell the app how should it use the DLL files.

The license won't let you have the complete SDL embedded in your app.
------ XYE - A new edition of the classic Kye
ah.. ok, i had to put it in the same folder. thanks, but now i'm getting an error with the Uint8 type... i guess it's not seeing it or something. is ther something wrong with it? ic an't just declare a variable with type "Uint8"?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
I'd check all the spelling/caps on "Uint8", since it sucks to miss really stupid errors - but I never had a problem with that when I set up. Maybe it's a linker thing?
It only takes one mistake to wake up dead the next morning.
It's Uint8. But incase you don't have it:
typedef unsigned char Uint8;typedef unsigned short int Uint16;typedef unsigned long int Uint32;typedef unsigned long long int Uint64;


I'm not sure if the Uint64 was supported everywhere, though.

C++
Quote:Original post by Frequency
I'd check all the spelling/caps on "Uint8", since it sucks to miss really stupid errors - but I never had a problem with that when I set up. Maybe it's a linker thing?


Also, try:
#pragma comment(lib, "SDLmain.lib")#pragma comment(lib, "SDL.lib")


I think you are missing the 'main' one. It's the one that defines SDL_Main and other things, among which may be Uint8.
You will need to include "SDL.h" in that file that it's not found in. As the other AP above posted, Uint8's are just typedefs and right now, that definition is missing.
Quote:Original post by Drew_Benton
You will need to include "SDL.h" in that file that it's not found in. As the other AP above posted, Uint8's are just typedefs and right now, that definition is missing.


Good point.

Although, if he was missing that wouldn't he get undefined's for everything with 'SDL_'?

C++
Quote:Original post by Anonymous Poster
Although, if he was missing that wouldn't he get undefined's for everything with 'SDL_'?


He would, except in the most common case that this is happening in another file, perhaps a header file, that does not yet use any SDL code. For example:

KeyBoardInput.h
#ifndef KB_H_#define KB_H_class KB_Input{   private:      vector <Uint8*> bufferedKeyArray;   public:      KB_Input();      ... member functions ...}#endif


KeyBoardInput.cpp
#include "KeyBoardInput.h"#include "SDL.h"KB_Input::KB_Input(){}... rest of member implementations ...

This topic is closed to new replies.

Advertisement