0
votes

I am trying to compile my code using b2 tool from Boost .My code is written in C++ and contains some functions calls from C libraries like .

During the compilation phase, the compiler mixes between two functions, the write function which is part of the unistd, and the write function which is part of the Boost librarues.

/home/ha/MIH/boost_1_49_0/boost/asio/impl/write.hpp:79:77: instantiated from ‘std::size_t boost::asio::write(SyncWriteStream&, const ConstBufferSequence&, CompletionCondition) [with SyncWriteStream = int, ConstBufferSequence = message*, CompletionCondition = long unsigned int, std::size_t = long unsigned int]’ socketmid.cpp:152:61: instantiated from here

The error happens in the write function which is used from unistid.h as following:

if (write(peer_fd, &confirm, sizeof (struct message)) < 0)
{
    ......   
}

So how can I solve this problem? Because as I know I can't use a namespace for C functions.

1

1 Answers

1
votes

You seem to call that from C++ code (otherwise Boost Asio won't work anyway), so you should be able to use the full qualified namespaces, e.g. boost::asio::write or ::write