2011-07-28 106 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不是必須的。 –