CUDA在Debug下编译有错而Release下无错
錯誤提示:
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in msvcrtd.lib(MSVCR90D.dll)
在經過搜索后采用了忽略 msvcrtd.lib,額外的庫添加:LIBCMT.lib
這樣可以編譯通過,但是Debug版本運行后很多錯誤提示。
后加入群,兩個人的意見有建設性!
1. 改成MTD,但現在編譯會提示
1>c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxver_.h(81) : fatal error C1189: #error :? Please use the /MD switch for _AFXDLL builds
然后他說: 也就是改用靜態庫,同時MTD。編譯運行通過
_AFXDLL tells the compiler to use the DLL version of the MFC libraries. But when you do this you must also use the DLL version of the CRT libraries (/MD compiler option).
?
When you switched to static linking, you should have changed to "Use MFC in a static library" (as Hans told you). This would have automatically changed your CRT setting to /MT. But it seems that you just changed to /MT without changing the MFC setting, so your project was inconsistent. When you got rid of _AFXDLL, the compiler thought you did not want MFC at all, so it did not recognize the MFC calls.
2.
把這兩個目錄:
SPH-CUDA(736183739) 17:40:36
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common
SPH-CUDA(736183739) 17:40:50
C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\shared
下的重新用MDd編譯。默認的是用MT編譯的,而我們自己自動生成的MFC里默認是MD編譯的,也就是不一致!
但這個我后來再改第一個方法成功后沒有嘗試這個。
轉載于:https://www.cnblogs.com/kyleada/archive/2011/08/11/2135352.html
總結
以上是生活随笔為你收集整理的CUDA在Debug下编译有错而Release下无错的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解题报告 Number
- 下一篇: 完整的Android 新浪微博api调用