libstdc++ GLIBCXX version errors

前端 未结 4 1265
野性不改
野性不改 2020-12-05 21:23

when I compile a c++ program in my computer using g++ and transfer the executable to run it on my university server, I get

./main: /usr/lib/libstdc++.so.6:          


        
4条回答
  •  情歌与酒
    2020-12-05 21:55

    The version of libstdc++.so.6 is too old on the university computer. You have two options:

    1. Statically link with -static. The C++ library will then be merged into the final binary.
    2. Copy the correct version to somewhere in your home directory, then reference it either by passing -rpath /path/to/library/directory at build time, or setting the LD_LIBRARY_PATH environment variable to point to the directory containing the newer libstdc++.so.6.

提交回复
热议问题