473,396 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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::deadline_timer t(io, boost::posix_time::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\hello.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.hpp:27,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/system_exception.hpp:33,
from
e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/detail/win_mutex.hpp:26,
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_registry.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.hpp: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.hpp: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.hpp:32:5:
warning: #warning Assuming _WIN32_WINNT=0x0500 (i.e. Windows 2000
target)
hello.cpp:24:2: warning: no newline at end of file
gcc.link bin\gcc\debug\hello.exe
bin\gcc\debug\hello.o: In function
`ZN5boost4asio6detail31reactive_deadline_timer_ser viceINS0_11time_traitsINS_10posix_time5ptimeEEENS1 _14select_reactorILb1EEEE16shutdown_serviceEv':e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_service.hpp:(.text$_ZN5boost4asio6d etail12winsock_initILi2ELi0EE7do_initC1Ev[boost::asio::detail::winsock_init<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:(.text$_ZN5boost4asio6d etail10socket_ops6selectEiP6fd_setS4_S4_P7timeval[boost::asio::detail::socket_ops::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:(.text$_ZN5boost4asio6d etail10socket_ops13error_wrapperIiEET_S4_[int
boost::asio::detail::socket_ops::error_wrapper<int >(int)]+0x8):
undefined reference to `WSAGetLastError@0'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_service.hpp:(.text$_ZN5boost4asio6d etail10socket_ops9set_errorEi[boost::asio::detail::socket_ops::set_error(int)]+0x17):
undefined reference to `WSASetLastError@4'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_service.hpp:(.text$_ZN5boost4asio6d etail12winsock_initILi2ELi0EE7do_initD1Ev[boost::asio::detail::winsock_init<2,
0>::do_init::~do_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:(.text$_ZN5boost4asio6d etail10socket_ops5closeEj[boost::asio::detail::socket_ops::close(unsigned
int)]+0x19): undefined reference to `closesocket@4'
bin\gcc\debug\hello.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\hello.o: In function
`ZN5boost4asio6detail31reactive_deadline_timer_ser viceINS0_11time_traitsINS_10posix_time5ptimeEEENS1 _14select_reactorILb1EEEE16shutdown_serviceEv':e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../..
o `closesocket@4'
bin\gcc\debug\hello.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\hello.o: In function
`ZN5boost4asio6detail31reactive_deadline_timer_ser viceINS0_11time_traitsINS_10posix_time5ptimeEEENS1 _14select_reactorILb1EEEE16shutdown_serviceEv':e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_service.hpp:(.text$_ZN5boost4asio6d etail10socket_ops5ioctlEjlPm[boost::asio::detail::socket_ops::ioctl(unsigned
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:(.text$_ZN5boost4asio6d etail10socket_ops6acceptEjP8sockaddrPi[boost::asio::detail::socket_ops::accept(unsigned
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:(.text$_ZN5boost4asio6d etail10socket_ops13error_wrapperIjEET_S4_[unsigned
int boost::asio::detail::socket_ops::error_wrapper<uns igned
int>(unsigned int)]+0x8): undefined reference to `WSAGetLastError@0'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_service.hpp:(.text$_ZN5boost4asio6d etail10socket_ops7connectEjPK8sockaddri[boost::asio::detail::socket_ops::connect(unsigned
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:(.text$_ZN5boost4asio6d etail10socket_ops6listenEji[boost::asio::detail::socket_ops::listen(unsigned
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:(.text$_ZN5boost4asio6d etail10socket_ops4bindEjPK8sockaddri[boost::asio::detail::socket_ops::bind(unsigned
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:(.text$_ZN5boost4asio6d etail10socket_ops10setsockoptEjiiPKvj[boost::asio::detail::socket_ops::setsockopt(unsign ed
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:(.text$_ZN5boost4asio6d etail10socket_ops9get_errorEv[boost::asio::detail::socket_ops::get_error()]+0x7):
undefined reference to `WSAGetLastError@0'
:e:/program/mingw/mingw/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/boost/asio/deadline_timer_service.hpp:(.text$_ZN5boost4asio6d etail10socket_ops6socketEiii[boost::asio::detail::socket_ops::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:(.text$_ZN5boost4asio6d etail10socket_ops4recvEjP7_WSABUFji[boost::asio::detail::socket_ops::recv(unsigned
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:(.text$_ZNK5boost4asio6 detail14fd_set_adapter6is_setEj[boost::asio::detail::fd_set_adapter::is_set(unsign ed
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:(.text$_ZN5boost4asio6d etail10socket_ops4sendEjPK7_WSABUFji[boost::asio::detail::socket_ops::send(unsigned
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\hello.exe...
....failed updating 1 target...
....updated 4 targets...

Aug 10 '06 #1
1 12713
??? 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
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...
0
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...
2
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...
1
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 <<...
0
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...
1
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
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...
1
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 =...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.