Problems compiling Boost.Test example with gcc under Linux

I suspect the answer to this is going to be really simple, but I've been trying to figure it out for several hours and I'm ready to give up (I couldn't even find a mention of the problem in the mailing list archives). All I want to do is use the Boost Unit Test library with gcc under Linux. I have Boost 1.32 correctly installed (I've used other libraries successfully without any problems). Now I simply try to compile the simplest possible example: http://www.boost.org/libs/test/example/unit_test_example1.cpp This is what I get: gcc -o test boost_test.cpp boost_test.cpp:11: error: `boost::unit_test' has not been declared boost_test.cpp:11: error: expected nested-name-specifier before "test_suite" boost_test.cpp:11: error: `test_suite' has not been declared boost_test.cpp:23: error: expected constructor, destructor, or type conversion before '*' token boost_test.cpp:23: error: expected `,' or `;' before '*' token boost::unit_test has not been declared??? How is that possible? The compiler is correctly including the boost/test/unit_test.hpp file from the first line of the program. What am I missing? It must be something really, really stupid. I can tell :-) Happy holidays everyone! --Noel Games from Within http://www.gamesfromwithin.com

"Noel Llopis" <nll_pub@convexhull.com> wrote in message news:200412231920.48218.nll_pub@convexhull.com...
I suspect the answer to this is going to be really simple, but I've been trying to figure it out for several hours and I'm ready to give up (I couldn't even find a mention of the problem in the mailing list archives).
All I want to do is use the Boost Unit Test library with gcc under Linux. I have Boost 1.32 correctly installed (I've used other libraries successfully without any problems).
Now I simply try to compile the simplest possible example: http://www.boost.org/libs/test/example/unit_test_example1.cpp
This is what I get: gcc -o test boost_test.cpp boost_test.cpp:11: error: `boost::unit_test' has not been declared boost_test.cpp:11: error: expected nested-name-specifier before "test_suite" boost_test.cpp:11: error: `test_suite' has not been declared boost_test.cpp:23: error: expected constructor, destructor, or type conversion before '*' token boost_test.cpp:23: error: expected `,' or `;' before '*' token
boost::unit_test has not been declared??? How is that possible? The compiler is correctly including the boost/test/unit_test.hpp file from the first line of the program. What am I missing? It must be something really, really stupid. I can tell :-)
Happy holidays everyone!
--Noel
My best guess is that you somehow picked up older version of Boost.Test, which does not have unit_test namespace. HTH, Gennadiy

Gennadiy Rozental wrote:
"Noel Llopis" <nll_pub@convexhull.com> wrote in message news:200412231920.48218.nll_pub@convexhull.com...
I suspect the answer to this is going to be really simple, but I've been trying to figure it out for several hours and I'm ready to give up (I couldn't even find a mention of the problem in the mailing list archives).
All I want to do is use the Boost Unit Test library with gcc under Linux. I have Boost 1.32 correctly installed (I've used other libraries successfully without any problems).
Now I simply try to compile the simplest possible example: http://www.boost.org/libs/test/example/unit_test_example1.cpp
This is what I get: gcc -o test boost_test.cpp boost_test.cpp:11: error: `boost::unit_test' has not been declared boost_test.cpp:11: error: expected nested-name-specifier before "test_suite" boost_test.cpp:11: error: `test_suite' has not been declared boost_test.cpp:23: error: expected constructor, destructor, or type conversion before '*' token boost_test.cpp:23: error: expected `,' or `;' before '*' token
boost::unit_test has not been declared??? How is that possible? The compiler is correctly including the boost/test/unit_test.hpp file from the first line of the program. What am I missing? It must be something really, really stupid. I can tell :-)
Happy holidays everyone!
--Noel
My best guess is that you somehow picked up older version of Boost.Test, which does not have unit_test namespace.
HTH,
You can use gcc -H to show what headers are being included. (BTW, the little dots it prints is my tiny contribution to gcc :)

On Friday 24 December 2004 04:10, Neal D. Becker wrote:
My best guess is that you somehow picked up older version of Boost.Test, which does not have unit_test namespace.
HTH,
You can use gcc -H to show what headers are being included. (BTW, the little dots it prints is my tiny contribution to gcc :)
Bingo! Thanks for pointing that out. It turns out I did have Boost 1.31 installed in /usr/include and that was being picked up before /usr/local/include. Thanks! --Noel Games from Within http://www.gamesfromwithin.com
participants (3)
-
Gennadiy Rozental
-
Neal D. Becker
-
Noel Llopis