--------------------------------------------------------------------------------------------------
main.cu.obj : error LNK2019: unresolved external symbol __imp____glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8
1>main.cu.obj : error LNK2019: unresolved external symbol __imp____glutCreateWindowWithExit@8 referenced in function _glutCreateWindow_ATEXIT_HACK@4
1>M:\____MareResearch____\CUDA_application\testCuda1000\Debug\testCuda1000.exe : fatal error LNK1120: 2 unresolved externals
1>main.cu.obj : error LNK2019: unresolved external symbol __imp____glutCreateWindowWithExit@8 referenced in function _glutCreateWindow_ATEXIT_HACK@4
1>M:\____MareResearch____\CUDA_application\testCuda1000\Debug\testCuda1000.exe : fatal error LNK1120: 2 unresolved externals
--------------------------------------------------------------------------------------------------
This errors are independent with cuda. It associated with the problem of OpenGL setting.
This errors are independent with cuda. It associated with the problem of OpenGL setting.
Firstly, let's check OpenGL related files.
: Window OS and VS 2012
*Header files
GL.h, GLU.h, glut.h (additionally, glext.h, wglext.h) are located in the below path.
" C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\GL "
*lib files
glut.lib, glut32.lib are located in
" C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib "
*dll files
glut32.dll. glut.dll are located in
"C:\Windows\System32"
*** ETC ***
: Visual Studio 2010
glut.h -> C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl
glut32.lib -> C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib
: Visual Studio 2008
glut.h -> C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl
glut32.lib -> C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
: Visual Studio 2005
glut.h -> C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include\gl
glut32.lib -> C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib
: Visual Studio 6.0
glut.h -> C:\Program Files\Microsoft Visual Studio\VC98\Include\GL
glut32.lib -> C:\Program Files\Microsoft Visual Studio\VC98\Include\Lib
If you do not have OpenGL files, you can download from this site.
glut.h -> C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl
glut32.lib -> C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib
: Visual Studio 2008
glut.h -> C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl
glut32.lib -> C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
: Visual Studio 2005
glut.h -> C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include\gl
glut32.lib -> C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib
: Visual Studio 6.0
glut.h -> C:\Program Files\Microsoft Visual Studio\VC98\Include\GL
glut32.lib -> C:\Program Files\Microsoft Visual Studio\VC98\Include\Lib
If you do not have OpenGL files, you can download from this site.
If you are testing example code of CUDA by example book and meet the same error like me, I modify one more thing.
I change the code in "gl_helper.h" like that..->
#include "GL/glut.h"
#include "GL/glext.h"
-->
#include < GL/glut.h>
#include < GL/glext.h>
Because "< " is referenced by VS path. Double quotes are referenced relative path and set by the user.
If you installed the OpenGL well, it will be no errors to run the following sources:
..
#include < gl/glut.h> void Display(){ glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glVertex3f(-0.5,-0.5,0.0); glVertex3f(0.5,-0.5,0.0); glVertex3f(0.5,0.5,0.0); glVertex3f(-0.5,0.5,0.0); glEnd(); glFlush(); } int main(){ glutCreateWindow("OpenGL Hello World!"); glutDisplayFunc(Display); glutMainLoop(); return 0; }..
No comments:
Post a Comment