error LNK2001: 沒法解析的外部符號 __CrtDbgReport

__CrtDbgReport說明

http://msdn.microsoft.com/zh-tw/library/vstudio/8hyw4sy7(v=vs.90).aspx多線程

int _CrtDbgReport( 
   int reportType,
   const char *filename,
   int linenumber,
   const char *moduleName,
   const char *format [,
   argument] ... 
);
int _CrtDbgReportW( 
   int reportType,
   const wchar_t *filename,
   int linenumber,
   const wchar_t *moduleName,
   const wchar_t *format [,
   argument] ... 
);

這個函數是用來判斷錯誤類型的。函數

但是問題出如今這裏:spa

// crt_crtdbgreport.c
#include <crtdbg.h>

int main() {
#ifdef _DEBUG       //這裏定義了一個宏
   CrtDbgReport(_CRT_ASSERT, NULL, NULL, "some module", NULL);
#endif
}

解決方法:

用release版,或者把debug版本中預編譯頭的_debug去掉,這樣在函數執行的時候就不會出現這個問題了。線程

具體是爲何每次只要執行CrtDbgReport 就出現錯誤我也不太明白。debug

其餘的什麼改多線程爲多線程調試…… 貌似都沒用調試

還有 忽略libcmt.lib庫 這個是處理衝突的庫的。感受這個問題可能也是庫衝突,但是找不到。code

相關文章
相關標籤/搜索