473,574 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to compile the HelloWorld of boost.asio?

How to compile the HelloWorld of boost.asio?
Maybe this is a stupid problem , but I really don't konw how to find
the right way.

My compile environment is
WinXP,
Msys ,
MinGw ,
G++ 3.4.2,
Boost 1.33.1,
asio_0_3_7,
bjam 3.1.13.

I have already copy the header files of boost and asio into
mingw/include

I write the helloWorld.cpp follow the tutorial.

#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>

int main()
{
boost::asio::io _service io;

boost::asio::de adline_timer t(io, boost::posix_ti me::seconds(5)) ;
t.wait();

std::cout << "Hello, world!\n";

return 0;

}

I write Jamroot as follow:

exe hello : hello.cpp ;

then I compile it in Msys, but link wrong happened(wrong messages see
the end of this Email).

Would you please help me to solve this problem .
Thank you for(;;){} //forever

$ bjam
....found 11 targets...
....updating 5 targets...
MkDir1 bin
MkDir1 bin\gcc
MkDir1 bin\gcc\debug
gcc.compile.c++ bin\gcc\debug\h ello.o
In file included from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/detail/win_local_free_ on_block_exit.h pp:27,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/system_exceptio n.hpp:33,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/detail/win_mutex.hpp:2 6,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/detail/mutex.hpp:27,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/detail/service_registr y.hpp:25,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/io_service.hpp: 32,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/basic_io_object .hpp:20,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/basic_socket.hp p:20,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/basic_datagram_ socket.hpp:25,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio.hpp:18,
from hello.cpp:11:
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/detail/socket_types.hp p:31:5:
warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS
appropriately
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/detail/socket_types.hp p:32:5:
warning: #warning Assuming _WIN32_WINNT=0x 0500 (i.e. Windows 2000
target)
hello.cpp:24:2: warning: no newline at end of file
gcc.link bin\gcc\debug\h ello.exe
bin\gcc\debug\h ello.o: In function
`ZN5boost4asio6 detail31reactiv e_deadline_time r_serviceINS0_1 1time_traitsINS _10posix_time5p timeEEENS1_14se lect_reactorILb 1EEEE16shutdown _serviceEv':e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail12win sock_initILi2EL i0EE7do_initC1E v[boost::asio::de tail::winsock_i nit<2,
0>::do_init::do _init()]+0x1f): undefined reference to `WSAStartup@8'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops6selectE iP6fd_setS4_S4_ P7timeval[boost::asio::de tail::socket_op s::select(int,
fd_set*, fd_set*, fd_set*, timeval*)]+0xc9): undefined reference to
`select@20'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops13error_ wrapperIiEET_S4 _[int
boost::asio::de tail::socket_op s::error_wrappe r<int>(int)]+0x8):
undefined reference to `WSAGetLastErro r@0'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops9set_err orEi[boost::asio::de tail::socket_op s::set_error(in t)]+0x17):
undefined reference to `WSASetLastErro r@4'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail12win sock_initILi2EL i0EE7do_initD1E v[boost::asio::de tail::winsock_i nit<2,
0>::do_init::~d o_init()]+0x7): undefined reference to `WSACleanup@0'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops5closeEj[boost::asio::de tail::socket_op s::close(unsign ed
int)]+0x19): undefined reference to `closesocket@4'
bin\gcc\debug\h ello.o: In function
`main':e:/job/word-online/source/cpp/hello.cpp:15: undefined reference
to `inet_addr@4'
:e:/job/word-online/source/cpp/hello.cpp:23: undefined reference to
`getsockname@12 '
bin\gcc\debug\h ello.o: In function
`ZN5boost4asio6 detail31reactiv e_deadline_time r_serviceINS0_1 1time_traitsINS _10posix_time5p timeEEENS1_14se lect_reactorILb 1EEEE16shutdown _serviceEv':e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../..
o `closesocket@4'
bin\gcc\debug\h ello.o: In function
`main':e:/job/word-online/source/cpp/hello.cpp:15: undefined reference
to `inet_addr@4'
:e:/job/word-online/source/cpp/hello.cpp:23: undefined reference to
`getsockname@12 '
bin\gcc\debug\h ello.o: In function
`ZN5boost4asio6 detail31reactiv e_deadline_time r_serviceINS0_1 1time_traitsINS _10posix_time5p timeEEENS1_14se lect_reactorILb 1EEEE16shutdown _serviceEv':e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops5ioctlEj lPm[boost::asio::de tail::socket_op s::ioctl(unsign ed
int, long, unsigned long*)]+0x27): undefined reference to
`ioctlsocket@12 '
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops6acceptE jP8sockaddrPi[boost::asio::de tail::socket_op s::accept(unsig ned
int, sockaddr*, int*)]+0x27): undefined reference to `accept@12'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops13error_ wrapperIjEET_S4 _[unsigned
int boost::asio::de tail::socket_op s::error_wrappe r<unsigned
int>(unsigned int)]+0x8): undefined reference to `WSAGetLastErro r@0'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops7connect EjPK8sockaddri[boost::asio::de tail::socket_op s::connect(unsi gned
int, sockaddr const*, int)]+0x27): undefined reference to `connect@12'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops6listenE ji[boost::asio::de tail::socket_op s::listen(unsig ned
int, int)]+0x20): undefined reference to `listen@8'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops4bindEjP K8sockaddri[boost::asio::de tail::socket_op s::bind(unsigne d
int, sockaddr const*, int)]+0x27): undefined reference to `bind@12'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops10setsoc koptEjiiPKvj[boost::asio::de tail::socket_op s::setsockopt(u nsigned
int, int, int, void const*, unsigned int)]+0x35): undefined reference
to `setsockopt@20'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops9get_err orEv[boost::asio::de tail::socket_op s::get_error()]+0x7):
undefined reference to `WSAGetLastErro r@0'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops6socketE iii[boost::asio::de tail::socket_op s::socket(int,
int, int)]+0x3f): undefined reference to `WSASocketA@24'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops4recvEjP 7_WSABUFji[boost::asio::de tail::socket_op s::recv(unsigne d
int, _WSABUF*, unsigned int, int)]+0x58): undefined reference to
`WSARecv@28'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZNK5boost4 asio6detail14fd _set_adapter6is _setEj[boost::asio::de tail::fd_set_ad apter::is_set(u nsigned
int) const]+0x14): undefined reference to `__WSAFDIsSet@8 '
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_ service.hpp:(.t ext$_ZN5boost4a sio6detail10soc ket_ops4sendEjP K7_WSABUFji[boost::asio::de tail::socket_op s::send(unsigne d
int, _WSABUF const*, unsigned int, int)]+0x58): undefined reference to
`WSASend@28'
collect2: ld returned 1 exit status

"g++" -o "bin\gcc\debug\ hello.exe" -Wl,--start-group
"bin\gcc\debug\ hello.o" -Wl,--end-group -g

....failed gcc.link bin\gcc\debug\h ello.exe...
....failed updating 1 target...
....updated 4 targets...

Aug 10 '06 #1
1 12733
??? wrote:
How to compile the HelloWorld of boost.asio?
Maybe this is a stupid problem , but I really don't konw how to find
the right way.
[...]
Have you tried looking on www.boost.org?

V
Aug 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
24793
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both classes in the directory called temp and I do cd temp to this directory. Then I do javac HelloWorld.java Now I get the compile error...
0
2659
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both classes in the directory called temp and I do cd temp to this directory. Then I do javac HelloWorld.java Now I get the compile error...
2
6962
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both classes in the directory called temp and I do cd temp to this directory. Then I do javac HelloWorld.java Now I get the compile error...
1
2784
by: Hayato Iriumi | last post by:
I guess I'm going through initiation while I try to get into C++. I can't even compile a Hello World app. Here is the code... #include <iostream> using namespace std; void main() { cout << "hello"; }
0
2501
by: ufnuceda | last post by:
Hello everyone, I was wondering if any of you have some experience with the boost library. I am having trouble compiling code with it. Since boost is being used a lot these days I thought some of you might have an answer. I would greatly appreciate help with this, as I tried to search for an answer for quite some time in vain. I am...
1
1921
by: Nagaraj | last post by:
hi all, I have simple basic c++ program "hello world" which i cant compile on linux system. I have given extension as .C. please tell me how to compile C++ programs on Linux.
4
7365
by: Technics | last post by:
Ok I will be as clearer as I can (sorry for english/technical mistakes) I would like to write an audio application that supports ASIO drivers. I downloaded the ASIO sdk from Stainberg and I read the docs and viewed the code provided. The sdk retrieve the varius ASIO drivers available from windows registry. The various drivers are COM...
1
4227
by: bje990 | last post by:
Here is the situation.... I have a device i connect to where i read a byte stream until some delimiter is found. boost::asio::streambuf response; size_t length = boost::asio::read_until(*comm_socket, response, delimiter); The problem is, the bytes i get back are correct except it strips out all the 0x11 characters. I have...
1
7150
by: wo3kie | last post by:
I had not any issues with Windows, but with Linux I failed It is going about an example from boost::asio library tutorial # Daytime.1 - A synchronous TCP daytime client # Daytime.2 - A synchronous TCP daytime server After compilation, I changed access settings for files # chmod a+x server.cpp # chmod a+x client.cpp
0
7813
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7736
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8066
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6461
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5305
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3743
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2251
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.