C++ Qt creator 添加外部库(仍然:无法打开包含文件:'GL/glew.h')
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14742856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Qt creator Adding external library (still: Cannot open include file: 'GL/glew.h')
提问by lightrek
I followed the instruction:
我按照说明操作:
- In the Projects pane, open the project file (.pro).
- Right-click in the code editor to open the context menu and select Add Library....
- 在“项目”窗格中,打开项目文件 (.pro)。
- 在代码编辑器中右键单击以打开上下文菜单并选择添加库...。
Then the following lines were added into the pro file:
然后将以下行添加到 pro 文件中:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/D:/OpenGL/glew-1.5.4/lib/ -lglew32
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/D:/OpenGL/glew-1.5.4/lib/ -lglew32d
INCLUDEPATH += $$PWD/D:/OpenGL/glew-1.5.4/include
DEPENDPATH += $$PWD/D:/OpenGL/glew-1.5.4/include
However, I click the green triangle icon on the bottom left the run the program, still get the errors:
但是,我单击左下角的绿色三角形图标运行程序,仍然出现错误:
error: C1083: Cannot open include file: 'GL/glew.h': No such file or directory
错误:C1083:无法打开包含文件:'GL/glew.h':没有这样的文件或目录
回答by user1418638
I had the same problem and I figured it out just now: You have to run qmake(build->run qmake) to validate changes in the pro file.
我遇到了同样的问题,我刚刚想通了:您必须运行 qmake(build->run qmake) 来验证 pro 文件中的更改。
回答by Kavin
INCLUDEPATH += D:/OpenGL/glew-1.5.4/include
LIBS += -Lc:D:/OpenGL/glew-1.5.4/lib -lname
Just add the above line in the .pro file.Then check it.
只需在 .pro 文件中添加上面的行。然后检查它。
回答by Moritz Jasper
Check if the desired files really exist under D:/OpenGL/glew-1.5.4/include
. I.e. is there a folder named GL and inside it a file named glew.h?
检查所需的文件是否确实存在于D:/OpenGL/glew-1.5.4/include
. 即有一个名为 GL 的文件夹,里面有一个名为 glew.h 的文件吗?
Then try to remove the $$PWD/
part from the paths.
然后尝试$$PWD/
从路径中删除该部分。
If this doesn't help replace the generated lines with just those two lines:
如果这不能帮助仅用这两行替换生成的行:
LIBS += -L$$quote(D:/OpenGL/glew-1.5.4/lib/) -lglew32
INCLUDEPATH += $$quote(D:/OpenGL/glew-1.5.4/include)