On Sun, Apr 20, 2008 at 07:36:58PM +0000, 7stud wrote:
Here is the tutorial example:
#include
#include <iostream> #include <iterator> #include <algorithm> int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each(in(std::cin), in(), std::cout << (_1 * 3) << " " ); return 0; }
And this is what happens:
gcc -I /usr/local/boost_1_34_1 prog1.cpp
Please use the C++ compiler "g++" instead of the C compiler "gcc".
/usr/bin/ld: Undefined symbols:
Ah, OK, now the compiler error vanished as the compiler is able to find the header files of boost. [The following can probably be ignored as I missed at the beginning the you used the C compiler. Nevertheless you may find the next usful in you later steps:] Now the linker complains about symbols (such as functions) defined in a Boost library which you have to link against. You need for linking the additional options -L /usr/local/boost_1_34_1/lib/ (to specify the library search path) -l boost??? (to specify the library) Sorry, I do not remember the library name which contains lambda. Just look into your /usr/local/boost_1_34_1/ for available dynamic lib/libboost*.so or lib/libboost*.a static libraries and choose the right one (without lib prefix or .so or a suffix). Please note that this kind of question indicate that you are not very familiar with a C++ compiler. That's not a problem but please try to find such answers yourself by following more basic C++/g++ tutorials. Starting with a simple "Hello world" program is typically the first step. Jens