0

所以我是 C++ 的新手,在过去的几天里,我一直在尝试编译一个程序。我为我的幻像 OMNI 下载了 OpenHaptics,并一直在尝试编译一个简单的球体程序。它给我的错误如下(我使用的是 Visual c++ 2010)

我认为问题在于它可能没有读取 glut32.dll 文件(基于互联网研究)我如何添加这个 .dll 文件以便编译器看到它,或者如果还有其他问题我该如何解决?

------ Build started: Project: Spheretest, Configuration: Debug Win32 ------
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void     __cdecl qhStart(void)" (__imp_?qhStart@@YAXXZ) referenced in function _main
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QHRenderer::tell(class Cursor *)" (__imp_?tell@QHRenderer@@QAEXPAVCursor@@@Z) referenced in function _main
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Cursor::Cursor(void)" (__imp_??0Cursor@@QAE@XZ) referenced in function _main
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QHRenderer::tell(class Sphere *)" (__imp_?tell@QHRenderer@@QAEXPAVSphere@@@Z) referenced in function _main
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Sphere::Sphere(void)" (__imp_??0Sphere@@QAE@XZ) referenced in function _main
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QHRenderer::tell(class DeviceSpace *)" (__imp_?tell@QHRenderer@@QAEXPAVDeviceSpace@@@Z) referenced in function _main
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall DeviceSpace::DeviceSpace(void)" (__imp_??0DeviceSpace@@QAE@XZ) referenced in function _main
Sphereguts.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QHGLUT::QHGLUT(int,char * * const)" (__imp_??0QHGLUT@@QAE@HQAPAD@Z) referenced in function _main
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
C:\Users\Ryan Grainger\Desktop\c++ test\Spheretest\Debug\Spheretest.exe : fatal error LNK1120: 9 unresolved externals

========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========

4

1 回答 1

0

确保列出.lib要链接的库的文件。

另外...main()您的源代码中没有。或者,更确切地说,没有Windows特定的模拟被称为WinMain()- 并且链接器不喜欢它。

您需要提供WinMain(),或构建一个非Windows可执行文件(只是一个console application?),或将所有必要的文件包含到您的解决方案中(文件集必须包含其中包含WinMain()函数的文件)

于 2012-07-25T22:48:05.343 回答