Statically compiling C++ using WSL in Visual Studio

Emir 1 Reputation point
2021-03-23T16:53:34.227+00:00

I compiled a program using Windows 10 and Visual Studio 2019 with WSL (Windows Subsystem for Linux). However when I ran the program on a server, it printed an error message:

/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

The code does not have any external dependencies other than standard C++ libraries, i.e., all of the source files are in the project.

It seems to be the case that WSL did not statically compile the executable but relies on external libraries. I configured the project to compile statically (right-click on the project / Properties / Configuration Properties / General / Project Defaults / Use of STL: Static GNU Standard C++ Library (-static)), however the resulting executable did not change at all.

Could you please help me out? I would greatly appreciate it!

Developer technologies C++
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.