SDL for OpenGL

Started by
4 comments, last by Sik_the_hedgehog 9 years, 8 months ago

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!

Advertisement

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.

Post your Code, and your IDE configurations and I will try to help you.

KrinosX


#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. smile.png

EDIT:

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

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.

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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

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.

Post your Code, and your IDE configurations and I will try to help you.

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.

This topic is closed to new replies.

Advertisement