Error compiling boost:interprocess
Hi, I'm doing a program that uses threads to launch a function using threads. I implemented the following code: #include <iostream> #include <boost/thread.hpp> void NewFunc() { std::cout << "NewFunc running" << std::endl; //do something std::cout << "NewFunc finished" << std::endl; } int main(int argc, char* argv[]) { boost::thread FuncThread(NewFunc); FuncThread.join(); } And I receive a few errors: g++ -c -g -MMD -MP -MF build/Debug/GNU-Solaris-x86/main.o.d -o build/Debug/GNU-Solaris-x86/main.o main.cpp main.cpp: In function `int main(int, char**)': main.cpp:19: error: `boost' has not been declared main.cpp:19: error: `thread' undeclared (first use this function) main.cpp:19: error: (Each undeclared identifier is reported only once for each function it appears in.) main.cpp:19: error: expected `;' before "FuncThread" main.cpp:20: error: `FuncThread' undeclared (first use this function) Any idea why this is failing? Thanks
It seems that the compiler can't find boost/thread.hpp, and from the compile line you seem to be missing something that specifies the include directory location, something along the lines: g++ -c -g -MMD -MP -MF -I/$BOOST_DIR/include build/Debug/GNU-Solaris-x86/main.o.d -o build/Debug/GNU-Solaris-x86/main.o main.cpp Hope this helps, --Alex On Mon, Feb 8, 2010 at 11:23 AM, Daniel Veneros <dann.vd@gmail.com> wrote:
Hi, I'm doing a program that uses threads to launch a function using threads. I implemented the following code:
#include <iostream>
#include <boost/thread.hpp>
void NewFunc()
{
std::cout << "NewFunc running" << std::endl;
//do something
std::cout << "NewFunc finished" << std::endl;
}
int main(int argc, char* argv[])
{
boost::thread FuncThread(NewFunc);
FuncThread.join();
}
And I receive a few errors:
g++ -c -g -MMD -MP -MF build/Debug/GNU-Solaris-x86/main.o.d -o build/Debug/GNU-Solaris-x86/main.o main.cpp
main.cpp: In function `int main(int, char**)':
main.cpp:19: error: `boost' has not been declared
main.cpp:19: error: `thread' undeclared (first use this function)
main.cpp:19: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:19: error: expected `;' before "FuncThread"
main.cpp:20: error: `FuncThread' undeclared (first use this function)
Any idea why this is failing?
Thanks
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Alexander E. Maslowski (253) - 376 - 2730
participants (2)
-
Alexander Maslowski
-
Daniel Veneros