User forums > Using Code::Blocks
Boost.Asio Linking Help
Alpha:
--- Quote from: JakeKazmier on June 28, 2012, 02:24:10 pm ---I found the dependencies but it did not list "ws2_32" any idea why?
--- End quote ---
It is rather cryptic.
--- Quote ---When compiling for Windows using Microsoft Visual C++ or Borland C++, Boost.Asio will automatically link in the necessary Windows SDK libraries for sockets support (i.e. ws2_32.lib and mswsock.lib, or ws2.lib when building for Windows CE). The BOOST_ASIO_NO_DEFAULT_LINKED_LIBS macro prevents these libraries from being linked.
--- End quote ---
Which means that on Windows, you need Windows Sockets API, which, in MinGW, is available through ws2_32.
--- Quote from: JakeKazmier on June 28, 2012, 02:24:10 pm ---For future reference though, is there a file I should be looking for?
--- End quote ---
Normally, libraries for MinGW (and GCC in general) will be named in the form of lib*.a - when specifying them to the linker, the lib prefix and .a extension are not necessary. Wherever you installed boost to (assuming you compiled the libraries), there should be a folder with a bunch of libboost_*-mgw*-*-1_*.a files (the asterisks depend on your compiler, the version of boost you downloaded, and the configuration(s) you built). This folder needs to be in your linker search directories. The one with "system" in its name is the one you are trying to link to.
JakeKazmier:
Thanks, I found the files but it is still not working, I must be missing something. Here are some pictures to show you what I have...
Thanks
Uploaded with ImageShack.us
Uploaded with ImageShack.us
Uploaded with ImageShack.us
Uploaded with ImageShack.us
Alpha:
This linker error is a result of trying to compile an executable without a main method ( int main(int argc, char* argv[]){ ... } ). If you do have a main(), go to Project->Properties...->Build targets (tab) and ensure that you have selected "Console application" for the type (not "GUI application").
(By the way, try Google/your favorite search engine occasionally; keywords from this error yield a lot of results. Also, you are probably tempting admins to lock this thread due to irrelevance to Code::Blocks itself - some of your questions belong on general programming forums - search the web, there are plenty of them.)
JakeKazmier:
That does not work... When I search the error online nothing relevant appears. But what if the error is not caused by linking, but by my incompetence. In one of my above posts I give a link to the example I am using with Boost.asio. I know the key c++ concepts and the basics on using codeblocks, but I haven't seriously programmed with c++, does that make sense? So maybe im compiling the example wrong because they have three projects that should run together I guess... I am really stumped on how to use this. And about finding the solution to the problem online: crazy. There is no clear solution to the problem, a lot of people use a different IDE, others not the same library, its a mess. If anyone could help I would really appreciate it.
Uploaded with ImageShack.us
I tried to compile the example that they gave for filesystem and THAT doesn't work. Very irritating. Here is a pic of that compile if its of use...
Uploaded with ImageShack.us
stahta01:
Turn on Full Compiler Logging. http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Then, I suggest posting on a different website.
Pick one that supports your Compiler and/or the library that is causing the linking issue.
Remember when linking the order order of the library/object files matter with most compilers/linkers.
Tim S.
Navigation
[0] Message Index
[*] Previous page
Go to full version