• Create Account

## SDL for OpenGL

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.

5 replies to this topic

### #1ibranext  Members

104
Like
-1Likes
Like

Posted 23 July 2014 - 07:48 AM

Hello, I need a little help, I'm trying to launch my OpenGL program with SDL, but It never worked, I followed over 4 tutorials but nothing worked, I  managed to land on only 1 error but that error says:

..

..

1>------ Build started: Project: OpenGLProject, Configuration: Debug Win32 ------
1>  main.cpp
1>c:\projects\opengl\project 2\openglproject\openglproject\main.cpp(2): fatal error C1083: Cannot open include file: 'SDL.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


..

..

I tried to search it up many times but I got no decent results.

Also I did include the SDL 2.0.3 .h/.dll/.lib files in the correct places.

..

Any help will be great!

### #2krinosx  Members

606
Like
1Likes
Like

Posted 23 July 2014 - 08:58 AM

May you post some code?

How are you doing the '#include'?

A simple mistake is to include like it:

#include "SDL\SDL.h"

but your include path has no 'SDL' folder, just the SDL.h file.

### #3ibranext  Members

104
Like
0Likes
Like

Posted 23 July 2014 - 09:34 AM

#include <iostream>
#include <SDL.h>

int main(int argc, char **argv){
if (SDL_Init(SDL_INIT_EVERYTHING) != 0){
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Quit();

return 0;
}


Here is the code, I am using Visual C++ 2010.

EDIT:

Well, that simple peace of code is not functional, so all my my code is kind of useless until I fix it.

Edited by ibranext, 23 July 2014 - 09:57 AM.

### #4Lactose!  GDNet+

9597
Like
0Likes
Like

Posted 23 July 2014 - 11:06 AM

You're trying to include the SDL.h file, but it can't be found by your build process. Thus, we need to know where your files are, and how the build process is set up.

You need to show/tell us what your include directories, etc. look like. We can't just guess these things, and it's most likely in some details there the problem lies.

Hello to all my stalkers.

### #5mhagain  Members

12429
Like
0Likes
Like

Posted 23 July 2014 - 12:50 PM

Also I did include the SDL 2.0.3 .h/.dll/.lib files in the correct places.

The error you're getting indicates that you actually didn't.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.

### #6Sik_the_hedgehog  Members

2948
Like
0Likes
Like

Posted 24 July 2014 - 12:27 AM

May you post some code?

How are you doing the '#include'?

A simple mistake is to include like it:

#include "SDL\SDL.h"

but your include path has no 'SDL' folder, just the SDL.h file.

Usually it's the other way: trying to do #include "SDL.h" because the documentation says so, but the compiler can't find that file because it's actually SDL/SDL.h (hint: the documentation assumes you're using pkg-config or something similar which adds SDL's directory in the include path).

Note: for SDL 2.0 it's "SDL2/SDL.h".

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

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.