how to compile with libstdc++ fedora

g++ -o output_file source_file.cpp -std=c++11 -stdlib=libstdc++
  • g++: Command to invoke the GNU C++ compiler.
  • -o output_file: Specifies the name of the output file that will be generated after compilation.
  • source_file.cpp: The name of the C++ source file to be compiled.
  • -std=c++11: Specifies the C++ standard to be used during compilation. In this case, C++11 standard is selected.
  • -stdlib=libstdc++: Specifies the C++ standard library to be used. This flag explicitly instructs the compiler to link against the libstdc++ library.

Replace output_file with the desired name for the compiled executable file and source_file.cpp with the name of your C++ source file. Adjust the C++ standard flag (-std=c++11 in this case) to match the version you intend to use.