2

I'm cross-compiling a C++ program. But when I try to run on the target computer it can't find the C++ libs (namely libstdc++.so.5).

Is there a way to bundle all the dependencies so I can run on the target computer?

Or do I have to install them on the target computer?

4

1 に答える 1

4

Try g++ -static x.cc -o x. This will link all of your libraries, including libstdc++, into your executable.

Of course, the resulting image will be larger than a dynamically-linked image.

于 2012-11-27T18:37:59.253 に答える