Segmentation fault – libstdc++-6.dll 分割错误 – libstdc++-6.dll

huangapple go评论95阅读模式
英文:

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 &lt;iostream&gt;

int main() {
    std::cout &lt;&lt; &quot;Hello, world!&quot; &lt;&lt; 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 &#39;C:\Users\xxxx\AppData\Local\Programs\Julia-1.8.2\bin\libstdc++-6.dll&#39;. Symbols loaded.

Basically, make sure to check your path Segmentation fault – libstdc++-6.dll
分割错误 – libstdc++-6.dll Especially for other programming languages (or maybe other older versions of your C++ compiler).

huangapple
  • 本文由 发表于 2023年7月6日 22:01:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76629649.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定