我的代码编译好但不运行 [英] My code compiles fine but does not run
问题描述
我正在尝试运行以下代码
I'm trying to run the following code
#include <iostream>
#include <string>
using namespace std;
class DivyasClass{
public:
string name;
};
int main()
{
DivyasClass dobj;
dobj.name = "Divya Sharma";
cout << dobj.name;
return 0;
}
我尝试使用Code :: Blocks以及命令行运行它,但它给出了以下错误消息:
程序入口点_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1Ev无法位于动态链接库中
我尝试过:
我在网上发现了类似的问题,但解决方法是使用g ++编译器。我的代码:: blocks已经在使用g ++编译器,并且通过命令行我也使用g ++编译器编译了程序。所以我不知道接下来该做什么。请帮忙!
I've tried running it using both Code::Blocks as well as the command line, but it gives the following error message:
The procedure entry point _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1Ev could not be located in the dynamic link library
What I have tried:
I found a similar question online, but the solution was to use the g++ compiler. My code::blocks is already using the g++ compiler and through the command line I compiled the program using the g++ compiler as well. So I don't know what to do next. Please help!
推荐答案
您的代码很好,您可以在线测试:免费在线IDE和终端 [ ^ ]
所以我会查看你的配置或者重新安装Code :: Blocks。
Your code is fine, you can test that online: Free Online IDE and Terminal[^]
So I would look at your configuration or maybe reinstall Code::Blocks.
这篇关于我的代码编译好但不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!