所以我是c ++的新手,过去几天我一直试图让程序编译。我为我的幻影OMNI下载了OpenHaptics,并且一直试图让一个简单的球体程序进行编译。它给我的错误如下(我使用的是Visual c + + +)
我认为问题在于它可能没有读取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跳过==========
答案 0 :(得分:0)
确保列出要链接的库的.lib
个文件。
此外...您的源代码中没有main()
。或者说,没有Windows
特定的模拟名为WinMain()
- 并且链接器不喜欢它。
您需要提供WinMain()
,或构建非Windows
可执行文件(只需console application
?),或将所有必要文件包含在您的解决方案中(文件集)必须包含其中包含WinMain()
函数的那个)