fatal error LNK1169: one or more multiply defined symbols found 解決方法

1.Linker Tools Error LNK1169

one or more multiply defined symbols found

The build failed due to multiple definitions of one or more symbols. This error is preceded by error LNK2005.

The /FORCE or /FORCE:MULTIPLE option overrides this error.

也就是"在 Project/Setting/Link/General中的 Project Options: 加入 /FORCE:MULTIPLE即可"

2.Linker Tools Error LNK2005

symbol already defined in object

The given symbol, displayed in its decorated form, was multiply defined.

Tips

One of the following may be a cause:

  • The most common cause of this error is accidentally linking with both the single-threaded and multithreaded libraries. Ensure that the application project file includes only the appropriate libraries and that any third-party libraries have appropriately created single-threaded or multithreaded versions.//到 "Project屬性" -> "C/C++" -> "代碼生成(code generation)" -> "運行時庫(run-time library)" 項下設置應用程序爲多線程,或單線程
  • The given symbol was a packaged function (created by compiling with /Gy) and was included in more than one file but was changed between compilations. Recompile all files that include the symbol. //C語言提供了一種將多個目標文件打包成一個文件的機制,這就是靜態程序庫(static library)。程序庫爲開發者帶來了方便,但同時也是某些混亂的根源......略去
  • The given symbol was defined differently in two member objects in different libraries, and both member objects were used.//不同庫中對同一全局對象有不同定義.
  • An absolute was defined twice, with a different value in each definition. //.//不同庫中對同一全局對象有不同值.

This error is followed by fatal error LNK1169.

     這裏只是給出了遇到這些錯誤時可能出現問題的原因。

    例如我是在VS2010裏面配置CLAPACK時,編譯出現錯誤,通過查閱資料發現,我們在所需工程中添加了CLAPACK庫後,其編譯方式 應該和 我們在編譯CLAPACK庫文件時所選的方式要相同(http://www.docin.com/p-105319970.html),如都選MT/d,就不會彈出這個錯誤。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章