2011-07-28 122 views
0

在建设中的Qt模拟器游戏代码,我发现了以下错误:的Qt的OpenGL ES库链接错误

-1: error: LNK1104: cannot open file 'libEGL.lib'

我已经添加以下代码以添加库文件:

INCLUDEPATH += C:\Imagination_Technologies\POWERVR_SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\Include\
LIBS += -LC:\Imagination_Technologies\POWERVR_SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\WindowsX86\Lib\ -llibEGL -llibGLESv2

LIBS += -llibEGL -llibGLESv2

+0

请提供在C文件的列表:\ Imagination_Technologies \ POWERVR_SDK \ OGLES2_WINDOWS_X86EMULATION_2.08.28.0634 \构建\ OGLES2 \ WindowsX86 \ LIB \ –

+0

以下4个文件有此文件夹中:1)libEGL.dll 2)libEGL OBJ文件3)libGLESv2.dll 4)libGLESv2 obj文件 – hurricane

回答

-2

这错误消息已足够明确:在指定的路径上找不到libEGL.lib

这些是一些GNU链接器规则,引自MinGW docs

  • If the library is not found in any of the default library search paths, you may also need to insert an appropriate -L<dir> switch to specify its location; (it is recommended that you place the -L switch before the -l` specification which requires it).
  • Note that the library names lib<name>.a and lib<name>.lib are not equivalent; if you have a library named according to the aberrant lib<name>.lib convention, it will not be found by an -l<name> specification -- if you cannot rename the library, you must use the form -llib<name> instead.
+0

我已经指定了libEGL.lib路径.....可以üPLZ告诉我如何添加这个特定的lib – hurricane

+0

根据你的评论,没有libEGL.lib文件在你的路径,只有.obj和.dll。你应该将obj文件链接到你的可执行文件,或者直接从程序中加载/使用dll文件。最后的评论不属于这个问题范围。 –

+0

Downvoter(s),请提供一个理由。否则,你们正在窃取我们两方的声誉,而没有明确哪些是错误的。 –

0

它一直以来我停止在Windows下编程的一段时间,但据我记得QMAKE使用在Linux中使用的所有支持的操作系统(http://doc.qt.io/qt-5/qmake-project-files.html)相同的机制。这意味着你应该写:

LIBS += -LC:\Imagination_Technologies\POWERVR_SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\WindowsX86\Lib\ -lEGL -lGLESv2 

当然提供的路径是正确的(注意我删除了'lib')。

+0

它不起作用:-( – hurricane

+0

它应该根据文档:http://doc.qt.nokia.com/latest/qmake-variable-reference.html#libs。尝试指定后缀。如果这是不工作,试着简单地指定文件的整个路径,包括文件名。我没有在路径中看到任何空格,所以$$ quote不是必须的。 –