Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 链接库(C+;+;)_C++_Linker - Fatal编程技术网

C++ 链接库(C+;+;)

C++ 链接库(C+;+;),c++,linker,C++,Linker,通过eclipseforc/C++使用MinGW,并试图让GLUT(openglutilitytoolkit)在其上工作,但我怀疑这是一个简单的问题 尝试构建会导致: g++-LC:\Documents and Settings\C\workspace\GLUTtest\Debug-LC:\Tools\MinGW\include\GL-LC:\Tools\MinGW\include-oGLUTtest.exe main.o-lglut32.lib C:\Tools\MinGW\bin..\lib

通过eclipseforc/C++使用MinGW,并试图让GLUT(openglutilitytoolkit)在其上工作,但我怀疑这是一个简单的问题

尝试构建会导致:

g++-LC:\Documents and Settings\C\workspace\GLUTtest\Debug-LC:\Tools\MinGW\include\GL-LC:\Tools\MinGW\include-oGLUTtest.exe main.o-lglut32.lib C:\Tools\MinGW\bin..\lib\gcc\mingw32\3.4.5……。\mingw32\bin\ld.exe:找不到-lglut32.lib

我在工作区目录C:\Documents and Settings\C\workspace\GLUTtest中有glut32.lib。以下是eclipse提供的选项:

-L“C:\Documents and Settings\C\workspace\GLUTtest”-L“C:\Documents and Settings\C\workspace\GLUTtest\Debug”-L“C:\Documents and Settings\C\workspace\GLUTtest\GL”-L“C:\Tools\MinGW\include\GL”-L“C:\Tools\MinGW\include”


你知道它为什么不接收库吗?

似乎你试图将include目录作为链接目录传递。找到包含glut32.lib的目录,并在找到的目录中添加链接目录参数(-L)。

您正在将“C:\Tools\MinGW\include\GL-LC:\Tools\MinGW\include”作为链接目录(-L)传递,该链接目录似乎是您的包含路径。因此,在包含路径中传递包含目录,该路径将显示-I选项,只需检查链接路径是否存在于使用-L选项给出的列表中,如果不存在,则将其添加到列表中,否则它将显示未定义的引用。

假设您有一个名为libxxx.a、libxxx.so或xxx.lib的库文件。链接时,应将参数设置为-lxxx


第二,有时您必须将库路径设置为(-L/path/to/lib/dir)

您是否尝试了-lglut32而不是-lglut32.lib?