1

I have Fortran target in CMake which relies on C++ libraries. What is portable way to include STDC++ into linking?

2 Answers 2

1

If you're linking with gfortran, add -lstdc++, if linking with g++, you'll need -lgfortran. Either way, you'll need both of them, it's just that g++ automagically links with libstdc++, and gfortran automagically links with libgfortran.

There is no "portable" way as in cross-compiler or cross-"standard library vendor", because all the libraries are named differently.

Sign up to request clarification or add additional context in comments.

Comments

0

Theoretically the STL is part of the C++, so you don't need to do anything in CMake to use STL. On other hand: if your C++ libraries have dependencies and their have CMake module (e.g.: FintQt4), CMake automatically handle the linking process.

1 Comment

The linker is not c++, rather fortran.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.