1. 程式人生 > >error LNK2019: 無法解析的外部符號 [email protected],該

error LNK2019: 無法解析的外部符號 [email protected],該

Reason: 學習使用socket,在stdafx.h檔案加了#include ,編譯

#include "stdafx.h"

#include

 

using namespace std;

 

int _tmain(int argc, _TCHAR* argv[]) {

    int socketId;

 

    socketId = socket(AF_INET, SOCK_STREAM, 0);

 

    return 0;

}

 

Error: error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 _wmain 中被引用

Solution: 專案->屬性->配置屬性->聯結器->輸入->附加依賴項”裡新增“ws2_32.lib”

 

error <wbr>LNK2019: <wbr>無法解析的外部符號 <wbr>_socket@12,該符號在函式 <wbr>_wmain <wbr>中被引用


 

參考自:http://blog.csdn.net/w174504744/article/details/7368169