英文:
Segmentation fault - libstdc++-6.dll
问题
I attempted to set up my environment for C++ development and follow the hands-on practice. However, when running a simple program that prints "Hello, world," I encountered the following output: "Segmentation fault." While debugging the code, it seems that the problem lies with the "libstdc++-6.dll" file. However, I'm not sure how to resolve this issue, and I'm also uncertain if it's a common problem. Can someone assist me?
I'm using Windows 11.
#include <iostream>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
Prompt
$ g++ hello.cpp -o hello
$ ./hello
Segmentation fault
英文:
I attempted to set up my environment for C++ development and follow the hands-on practice. However, when running a simple program that prints "Hello, world," I encountered the following output: "Segmentation fault." While debugging the code, it seems that the problem lies with the "libstdc++-6.dll" file. However, I'm not sure how to resolve this issue, and I'm also uncertain if it's a common problem. Can someone assist me?
I'm using Windows 11.
#include <iostream>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
Prompt
$ g++ hello.cpp -o hello
$ ./hello
Segmentation fault
答案1
得分: 2
我遇到了完全相同的问题,是由于我的路径中有另一个名为libstdc++-6.dll的dll文件引起的。对我来说,这是因为Julia编程语言。
在使用Visual Studio Code时,你可以查看加载了哪些文件,就像我的情况一样:
已加载 'C:\Users\xxxx\AppData\Local\Programs\Julia-1.8.2\bin\libstdc++-6.dll'。已加载符号。
基本上,请确保检查你的路径;特别是对于其他编程语言(或者可能是你的C++编译器的其他旧版本)。
英文:
I had the exact same problem, caused by another dll file on my path with the name libstdc++-6.dll. For me the it was because of the Julia programming language.
When using Visual Studio Code, you can see what files are loaded, in my case:
Loaded 'C:\Users\xxxx\AppData\Local\Programs\Julia-1.8.2\bin\libstdc++-6.dll'. Symbols loaded.
Basically, make sure to check your path Especially for other programming languages (or maybe other older versions of your C++ compiler).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论