0
我有一個巨大的CU文件,其中包含我的項目,即時嘗試將它分離成小的CU文件,但即時通訊許多gl.h錯誤,我不知道該怎麼做做...它的駕駛我瘋了..將Cuda CU文件分離爲許多其他文件和OPENGL編譯問題
1> Compiling CUDA source file core.cu...
1>
1> C:\Users\igal\Desktop\prj trying to devide files\graph>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -G0 --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -D_NEXUS_DEBUG -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "Debug\core.cu.obj" "C:\Users\igal\Desktop\prj trying to devide files\graph\core.cu"
1>c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\GL/gl.h(1152): error : this declaration has no storage class or type specifier
1>c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\GL/gl.h(1152): error : expected a ";"
1>c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\GL/gl.h(1153): error : this declaration has no storage class or type specifier
1>c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\GL/gl.h(1153): error : variable "WINGDIAPI" has already been defined
1>c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\GL/gl.h(1153): error : expected a ";"
和這樣的例子不勝枚舉..
感謝您的回答......以及我決定全部倒退,將CPP代碼與CU代碼分開,而不是像之前提到的那樣。 在每次調用cuda內核的CPP函數之前添加extern「c」命令後,我設法讓它工作...我的下一個挑戰是將內核導入到CPP類..不太確定該怎麼做用extern「c」命令 –