1. 程式人生 > >Eclipse c++ 中[Linker error] undefined reference to `

Eclipse c++ 中[Linker error] undefined reference to ` 阿新 發佈:2019-01-31

今天搭建了一個Eclipse+MinGW的C++開發環境,Eclipse的使用就是方便。
於是,就寫了一個socket程式,MinGW支援winsock2,但到編譯的時候總是報錯:
undefined reference to `
[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]

'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `
[email protected]
'

undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
undefined reference to `[email protected]'
這錯一看,要麼是程式沒有載入winsock2.h庫,要麼是程式make的時候出錯。
檢查console連線結果,發現確實是缺少socket的連結引數:-lws2_32.
在eclipse中新增make引數的方法:
右鍵工程 -> properties -> C++ build -> settings -> Tool Settings
在左邊樹形結構中選中 MinGW C++ Linker,此時在右邊的command line pattern就是make時的引數設定,在後面加上-lws2_32就可以了。
再編譯,成功了。
設定的截圖如下:

相關推薦

Eclipse c++ [Linker error] undefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4314100210372231373633037

今天搭建了一個Eclipse+MinGW的C++開發環境,Eclipse的使用就是方便。 於是,就寫了一個socket程式,MinGW支援winsock2,但到編譯的時候總是報錯:undefined reference to `[email protected]'

win10 QtCreator5.10 編譯opengl出現 error: undefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="17487e7a6748487

1、在pro檔案中新增:  LIBS += -lopengl32 -lGLU32 -lglut 2、在程式中新增以下3個頭檔案: 3、下載glut32庫,(已上傳到本地),解壓出現以下5個檔案 為簡單起見,複製全部檔案到安裝路徑的三個地方:      

初次使用Qt Creater網路程式設計,出現error: undefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="441b2d29341b1b131705173

在QT中編寫網路發報端/客戶端,時build時出現 error: undefined reference to `[email protected]’等,很多網路類似的錯誤 等大約10條e

opencv errorundefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e7b3aea1a1b5828683a38e9582849388959ea7a

ubuntu16.04,在make opencv3.4.0 的時候,出現以下錯誤 解決方法: 參考:https://blog.csdn.net/wangchuansnnu/article/details/44241199  在 cmake 時,新增 cmake -D

//home/sxl/miniconda2/lib/libpng16.so.16: undefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c9a0a7afa5a

編譯 caffe的命令中的 make all -j8 時出現: //home/sxl/miniconda2/lib/libpng16.so.16: undefined reference to `[email protected]_1.2.9' collect2: error: ld

Code::Blocks : undefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bac2c2c2c2c2c2fa8e">[email protec

使用CodeBlocks在編譯程式的時候出現如下錯誤: undefined reference to `[email protected]'undefined reference to `[email protect

caffe 編譯/usr/local/lib/libopencv_highgui.so: undefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bde9f4fb

caffe編譯出現 /usr/local/lib/libopencv_highgui.so: undefined reference to `[email protected]_4.0' 或者 /lib/libcaffe.so.1.0.0-rc5: undefin

Code::Blocks : undefined reference to `<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="047c7c7c7c7c7c4430">[email protec

使用CodeBlocks在編譯程式的時候出現如下錯誤: undefined reference to `[email protected]'undefinedreferenceto`[email protected]'undefinedreference

git上傳到一半最後報error:failed to push some refs to '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4c3cdd0e4c3cdd0ccd1c68ac7cbc9"

今天上傳程式碼到git上,上傳一半卡住了,過了一會兒就報: Counting objects: 52, done. Delta compression using up to 2 threads. Compressing objects: 100% (48/48), don

git push 時報錯 error: failed to push some refs to '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a3c4cad7e3dbdbdbdbdbdb">[ema

原因:這是一個新建的一個倉庫,提交到github時,沒有 pull下來,導致 github中的README.md檔案不在原生代碼目錄中 $ git push -u origin master To github.com:Houttuyniae/notes.git ! [

SpringBean的生命週期之<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="476a6a6a6a6a0705222629">[email protected]a>方法進行物件的初始化

方法:通過@Bean指定init-method和destroy-method; 注:單例項和原型模式物件的建立時間和初始化銷燬的時間順序不同。 一、單例項模式 1、建立Car例項物件,並建立初始化和銷燬方法 package com.atguigu.bean; imp

sql語句有insert然後有個<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4330262f26203703">[email protected]a>@identity,該怎麼執行

@@identity是表示的是最近一次向具有identity屬性(即自增列)的表插入資料時對應的自增列的值,是系統定義的全域性變數。 一般系統定義的全域性變數都是以@@開頭,使用者自定義變數以@開頭。select @@identity,在access或sqlserver中

com.bea.xml.XmlException: failed to load java type corresponding to <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f590c8829

在myeclipse裡部署Weblogic專案(web project)時候的問題 配置:Weblogic9.2  MyEclipse 7.0 第一:瀏覽器瀏覽時,報以下錯誤 Error 404--Not Found From RFC 2068 Hypertext T

error LNK2005: "int dir" (<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dae5beb3a89a">[email protected]a>@3HA) alrea

方案一、 程式設計中經常能遇到LNK2005錯誤——重複定義錯誤,其實LNK2005錯誤並不是一個很難解決的錯誤。弄清楚它形成的原因,就可以輕鬆 解決它了。         造成LNK2005錯誤主要有以下幾種情況:     1.重複定義全域性變數。可能存在兩種情況:  

XRecyclerView框架所遇到的bug,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3917616b5c5a405a555c4b6f505c4e1d7d584d58765b4a5c4b4f5

分析報錯的原因:頭調給介面卡註冊觀察者,再調註冊重複。 解決辦法: if (!coursesAdapter.hasObservers()){

undefined reference to symbol '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3242465a405753566d415b555f53415972">[email

/usr/bin/ld: CMakeFiles/xxxx/yyyyy.cpp.o: undefined reference to symbol '[email protected]@GLIBC

undefined reference to symbol <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e29a9aa2">[email protected]a>@GLIBC_2.2

記一次編譯過程 undefined reference to symbol  [email protected]@GLIBC_2.2.5  1. 開始以為是連結錯誤,更換庫的順序,但不奏效 2. 把動態庫換成靜態庫,這個肯定一樣的效果 3. 更新gcc版本 4.

【原創】叢集搭建報“Error unable to connect to nodes ['<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96e4f7f4f4ffe2d6e4fbe7bbf8a7

在rabbitmq叢集搭建時,將rmq-n2和rmq-n3兩節點加入rmq-n1時,報如下錯: 解決辦法: rabbitmq叢集是基於erlang叢集的,而erlang叢集中各節點間的通訊是通過4369埠和25672埠來進行通訊的, 所以:防火牆開啟4369埠和25672埠&nbs

[Visual Studio C++] [MFC 除錯錯誤]:error LNK2019: 無法解析的外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c09f9fa9adb09f9fb4a9a

1.編譯問題描述:  error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 "public: unsigned int __thiscall CMultimediatimerDlg::CreateTimer(void)" ([em

rabbitMQ報錯;解決方案Error: unable to connect to node <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="77051615151e03371b1814161b1f1

錯誤內容如下: 首先     # /sbin/service rabbitmq-server stop     # /sbin/service rabbitmq-server start     # rabbitmqctl status 執行上面內容 如果沒有出現剛才出現