0
votes

I tried to create empty project for Visual Studio.

// OpenGL1.cpp : main project file.
// #include "stdafx.h"
#include "windows.h"
#include <GL/gl.h>
#include <iostream>

using namespace System;

int main()
{
    std::cout << "Hello World" << "\n";
    return 0;
}

Having configured these dependencies:

opengl32.lib;glu32.lib;olepro32.lib;%(AdditionalDependencies);C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl;

And I got this error:

.NETFramework,Version=v4.0.AssemblyAttributes.cpp LINK : fatal error LNK1104: cannot open file 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl.obj'

Can you explain why this happens and how to remove the error?

1
linker inputs and include paths are different things - Sneftel
Most probably gl.h provides some static context object, that is instantiated and needs the GL library for linking. - πάντα ῥεῖ

1 Answers

1
votes

The "dependencies" refer to the filenames of libraries which the linker should use, not to include paths. Include paths are for the compiler, not for the linker.

You must first tell the linker where to find the OpenGL library file:

http://msdn.microsoft.com/en-us/library/1xhzskbe%28v=vs.100%29.aspx

And then, as a dependency, you specify only its name, not a full path. In this case, opengl32.lib.