01. 使用 Code::Blocks 寫 Socket Program 的設定
Settings -> Compiler and debugger -> Linker Settings -> Other linker options -> 加上 -lws2_32
02. 使用 Dev C++ 寫 Socket Program 的設定
Tools -> Compiler Options -> 打勾 Add these commands to linker command line -> 加上 -lws2_32
03. 使用 Microsoft Visual C++ 6.0 寫 Socket Program 的設定。// 以下方法擇一即可
a. 程式碼前面加上 #pragma comment(lib, "wsock32.lib")
b. Project -> Settings -> Link -> Object/library modules -> 最後加上 ws2_32.lib
Tags: C++ IDE, Code::Blocks, Socket, Windows, WinSock



May 19th, 2010 at 1:57 AM
您好~若用VS2008該如何LINK?謝謝!
May 20th, 2010 at 11:53 AM
1. 程式碼加 # include <winsock2.h>
2. 程式碼加 # pragma comment( lib, "ws2_32.lib" )
或 Solution Explorer -> Project Name 按右鍵 -> Configuration Properties -> Linker -> Command Line 的 Additional options 加 ws2_32.lib