Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The linker error message indicates that you need to link against the WinSock library. Boost.Asio is a header file only library; thus, there will be no <code>boost_asio</code> library to link against.</p> <hr> <p>The following example program is designed to introduce dependencies on the WinSock library.</p> <p><code>example.cpp</code>:</p> <pre><code>#include &lt;iostream&gt; #include &lt;winsock2.h&gt; int main() { WSAStartup(WORD(), LPWSADATA()); WSACleanup(); return 0; } </code></pre> <p>When compiling <code>example.cpp</code>, but not linking to the WinSock library, the following errors occur:</p> <pre><code>C:\example&gt;mingw32-g++.exe example.cpp example.cpp:(.text+0x26): undefined reference to `WSAStartup@8' example.cpp:(.text+0x2e): undefined reference to `WSACleanup@0' collect2: ld returned 1 exit status </code></pre> <p>However, when I link against <code>ws2_32</code>, the references are resolved:</p> <pre><code>C:\example&gt;mingw32-g++.exe example.cpp -lws2_32 C:\example&gt;dir /B a.exe example.cpp </code></pre> <p>Also note that the order in which the files are specified matters. Libraries must be specified after the names of all dependent modules. In this case, <code>example.cpp</code> is dependent on <code>ws2_32</code>; therefore, <code>ws2_32</code> must appear after <code>example.cpp</code>.</p> <pre><code>C:\example&gt;mingw32-g++.exe -lws2_32 example.cpp example.cpp:(.text+0x26): undefined reference to `WSAStartup@8' example.cpp:(.text+0x2e): undefined reference to `WSACleanup@0' collect2: ld returned 1 exit status </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload