Ashley Davies
Ashley Davies

Reputation: 1893

Making an OpenGL app without Windows.h

I've set the linker to additional dependencies opengl32.lib;glu32.lib;sfml-main-d.lib;

When I run it, I get loads of errors about APIEntry or something in one of the OpenGL files. SFML is also set up fine.

Here is my code:

#include <iostream>
//#include <Windows.h>
#include <gl/gl.h>
#include <gl/glu.h>

using namespace std;

void main()
{

}

It works fine if I include Windows.h, but I really don't want to make it windows-specific (Since the only reason I switched to C++ from C# is for cross platform and I'm not too fussed on Java)

Image of my errors

Upvotes: 0

Views: 2326

Answers (2)

Mads
Mads

Reputation: 724

If you're starting out you're probably not interested in the lower level stuff as setting up your own OpenGL context and such. I would recommend you take a look at GLFW at http://www.glfw.org/ - it is what I prefer for OpenGL. It is open source and cross platform for both Windows, linux and MAC.

Good luck!

Upvotes: 2

Nicol Bolas
Nicol Bolas

Reputation: 473312

If you're going to use OpenGL, then you should employ a proper OpenGL Loading Library to get your function pointers. These libraries have headers that will include whatever platform-specific stuff is needed to make the header work, using appropriate #defines and so forth.

Upvotes: 4

Related Questions