C++ 从标题编译<;字符串>&书信电报;堆栈>;没有任何输出

C++ 从标题编译<;字符串>&书信电报;堆栈>;没有任何输出,c++,powershell,terminal,C++,Powershell,Terminal,你能帮我吗 包括C++中的STL头文件,如 、 、 等,不提供任何输出。但是工作正常 对于,我也在声明中尝试了std::string 我已将C:\MinGW\bin包含到我的路径中 #include <iostream> #include <string> using namespace std; int main() { std::string str = "hello"; // string str = "hi"; cout <<

你能帮我吗

包括C++中的STL头文件,如<代码> <代码>、<代码> <代码>、<代码> <代码>等,不提供任何输出。但是

工作正常

对于
,我也在声明中尝试了
std::string

我已将
C:\MinGW\bin
包含到我的路径中

#include <iostream>
#include <string>
using namespace std;

int main()
{
    std::string str = "hello";
    // string str = "hi";
    cout << str;
}
在这两种情况下,我的PowerShell看起来都是这样的(PowerShell在
/hello.exe
之后不会执行任何操作):

I)查找路径
C:\MinGW\bin
中的
libstdc++-6.dll
二) 复制并粘贴到可执行目录中,即
hello.exe
所在的位置。

三) 现在执行它。

尝试更改为
cout@johnnymapp Windows shell无法很好地处理未以换行符IIRC结尾的行。因此,是的,追加
“\n”
应该有效。@M.Sol有一个隐式
返回0在代码的结尾> C++中的主< /代码>。Windows上的@ 2785528编译器通常添加“.exe”后缀。这几乎是Windows版本的设置可执行位。我以前也遇到过类似的问题。我认为问题在于windows在启动程序时会默默地忽略错误。加载程序时,windows很可能无法找到MinGW提供的一个或多个DLL。通常,通过双击文件资源管理器中的EXE,可以使Windows不忽略该错误
#include <iostream>
#include <stack>
using namespace std;

int main()
{
    stack<int> s;
    s.push(5);
    cout << s.top();
}
g++ --version
g++.exe (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.