Doing simple I/O in clntsrv example

Valentin Hauner valentinhauner at gmx.de
Sat May 17 13:00:08 CEST 2014


Hi!

I'm having some trouble with doing simple I/O actions in the clntsrv
example (/src/l4/pkg/examples/clntsrv).
I want the client to enter minuend and subtrahend himself, so I've added
the following code to client.cc:
> printf("Please enter minuend and subtrahend: \n");
> l4_uint32_t val1, val2;
> std::cin >> val1 >> val2;

iostream is included at the beginning of the file.

However, the linker has some serious problems:
> ==> Linking ex_clntsrv-client
> client.o: In function `main':
>
/home/hnr/l4re-core-2014022818/src/l4/pkg/examples/clntsrv/client.cc:60:
undefined reference to `std::cin'
>
/home/hnr/l4re-core-2014022818/src/l4/pkg/examples/clntsrv/client.cc:60:
undefined reference to `std::istream::operator>>(int&)'
>
/home/hnr/l4re-core-2014022818/src/l4/pkg/examples/clntsrv/client.cc:60:
undefined reference to `std::istream::operator>>(int&)'
> client.o: In function `__static_initialization_and_destruction_0':
> /home/hnr/l4reb/include/contrib/libstdc++-v3/iostream:72: undefined
reference to `std::ios_base::Init::Init()'
> /home/hnr/l4reb/include/contrib/libstdc++-v3/iostream:72: undefined
reference to `std::ios_base::Init::~Init()'
> make[1]: *** [ex_clntsrv-client] Error 1
> make: *** [/home/hnr/l4reb/pkg/examples/clntsrv/OBJ-x86_586-l4f] Error 2

I did not change the Makefile, so g++ is used for compiling (and not
gcc). I've added
> CXX_FLAGS = -lstdc++
but that doesn't help.

I'm using update-alternatives to have different versions of g++
installed simultaneously. Currently, the link points to g++-4.7. But
using g++-4.4 does not solve the problem either.

Thanks in advance for support!



More information about the l4-hackers mailing list