Megacan
Megacan

Reputation: 2518

Cross compile C++ application for target with just C

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?

Upvotes: 2

Views: 74

Answers (1)

Robᵩ
Robᵩ

Reputation: 168596

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.

Upvotes: 4

Related Questions