Share via

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++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

0 comments No comments

Your answer

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