Can't compile the simplest boost asio program

I can't compile the simplest boost asio program
#include <boost/asio.hpp> int main(){}

Code Blocks 13.12 writes out message "swprintf was not declared in this scope".
(within win_static_mutex.ipp file)

Visual Studio 2013 writes a lot more (within win_iocp_io_service.ip file), to begin with: "min is not a member of std" and there are a lot of errors in error.hpp file stating "WSA13 identificator is not defined" (WSA13, WSA100, WSA102 etc.)

Almost everything else from boost compiles good.

It will be great if somebody helps to fix my problem just in one way (but with code blocks is preferrable).
On Code::Blocks, simply try to include the swpritnf header and LINK IT. Seriously, when I was learning C++, I have always forgot about linking. Don't even know what's that? http://www.cprogramming.com/compilingandlinking.html
Last edited on
This appears to have been fixed: https://svn.boost.org/trac/boost/ticket/7373
Switching to a more current version of boost should resolve this.

This MinGW build comes with boost 1.57: http://nuwen.net/mingw.html
To JLBorges.

The last question is: is it hard to rewrite those 7 lines using std::strstream instead of swprintf, as the link suggested (or I'd better forget about it and install the newest boost)?
> is it hard to rewrite those 7 lines using std::strstream instead of swprintf, as the link suggested

No, it's not hard.


> or I'd better forget about it and install the newest boost

Install the newest boost. Other bugs may also have been fixed, improvements made, functionality added, brought more in line with C++11 ...
@JLBorges C++14!
Finally, I've made Code::Blocks compile it ! (and changed nothing with swprintf )

What I did:

A)
Project->Build options->Linker Settings->Link libraries:
1)C:\Boost\lib\libboost_system-mgw47-mt-1_52.a
2)C:\Windows\SysWOW64\ws2_32.dll

B)Search directories->Linker :
1)C:\boost_1_52_0\libs
2)C:\Windows\SysWOW64

There were 0 (zero) errors, but 75 warnings. I made a little test and everything (at least seemed to )worked good, the program did what I wanted, i.e read a text file hosted at a specified url and desplayed the contents through std::cout.



Last edited on
@axlprog You actually did. You linked it to the right file with its implementation.
Topic archived. No new replies allowed.