Missing include when compiling QT with Visual Stud

2019-03-20 19:43发布

I try to compile QT 5.0.0 in the command prompt of Visual Studio 2010 on Windows 7, 64bit. The process itself is known and described here and here. On my machine, compilation stops because the compiler does not find a file:

 fatal error C1083: [..] "GLES2/gl2.h": No such file or directory

I found that missing file in a subdirectory of C:\QTSources - the folder in which I try to build the sources.

I added the line INCLUDEPATH += "C:/QTSources/qtwebkit/Source/ThirdParty/ANGLE/include" to the file qtsdk.pro which seems to be used by qmake for the generation of the Makefile when I say configure [options]. This is suggested to do so here but it does not help. The path does show up neither in the Makefile nor in any call to the compiler.

How can I properly declare my include?

4条回答
虎瘦雄心在
2楼-- · 2019-03-20 20:26

I got the same problem attempting to build qt5.0 and qt5.1 with vs2012. The problem was simply solved by adding the parameter "-opengl desktop" (no quotes) to the config command and rebuilding (make/nmake/jom/mingw32-make). I think that all the other stuff mentioned in not necessary to fix you original stated problem.

查看更多
聊天终结者
3楼-- · 2019-03-20 20:29

When migrating form VS2008 to VS2010 (Win7) I had the same error message regarding "GLES2/gl2.h.

The solution was to add

\include\QtANGLE

to the "AdditionIncludeDirectory" parameter in the project properties.

QtANGLE is an alternative to the opengl graphics library as far as I know.

So it seems, that you don't have to build Qt from scratch on windows but you can use the precompiled version. At least not because of the present topic.

查看更多
来,给爷笑一个
4楼-- · 2019-03-20 20:30

I had the same problem and I finally found the solution (the only difference is that I'm using VS 2008, but I'm using Windows 7, and I needed the 64 bit target as you).

The main problem is that the compressed file that you download from the Qt site is not ok. You have to use what is in the Git repository (currently version 5.0.1, but not the same as the 5.0.1 version that you get from the downloads page)

Here is what I did, step by step, exactly:

prerequisites: have git, perl, python and ruby installed, you have to check your path to see if you can access the executables from anywhere. Search for download links here: http://qt-project.org/wiki/Building-Qt-5-from-Git under "Windows Build environment" section. For Git, download it from here http://git-scm.com

then do the following:

go to the directory where you want to install Qt.

git clone git://gitorious.org/qt/qt5.git qt5

cd qt5

perl init-repository --no-webkit

configure -developer-build -opensource -nomake examples -nomake tests

open a Visual Studio x64 Win64 Command Prompt, look for it or for VS 2008 you can execute: %comspec% /k ""c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" amd64

inside that window:

SET CL=/MP

configure -developer-build -opensource -nomake examples -nomake tests -opengl desktop

then press "y" for accepting the licence terms

nmake

...and that's all.

Note to the original question: You asked "How can I properly declare my include?" and after you explained the way you finally solved it: "...I copied the whole folder in which the file resides into a path known to the compiler...".

Instead of doing that, you might prefer to leave the folder in its original location and do the following before calling nmake:

SET CL=/Ic:\MyFolder

Note that I used SET CL=/MP before, that's for building faster by using the multiple cores of the processor. So, for that case, you should do:

SET CL=/MP /Ic:\MyFolder
查看更多
戒情不戒烟
5楼-- · 2019-03-20 20:38

Have you tried looking at this link?

http://qt-project.org/wiki/Building-Qt-5-from-Git

Windows Windows Graphics Drivers

QML2 requires OpenGL 2.1 or higher or Open GL ES 2.0 to work.

In Windows, two options are available:

Use the ANGLE-library [code.google.com] to translate OpenGL calls into DirectX (default)
Use the native OpenGL driver for your graphics card

A copy of ANGLE is bundled in Qt 5. To use Option 1, you need to install the DirectX SDK [msdn.microsoft.com] (Note: Starting from Windows Kit 8, this is included in the Windows SDK).

To use Option 2, you need to ensure that your graphics card driver supports OpenGL 2.1 or higher (Note: The stock Windows driver only supports OpenGL 1.1, which is insufficient), and pass `-opengl desktop’ to configure.exe.

查看更多
登录 后发表回答