Вы можете мне помочь?
Включение заголовочных файлов STL в C ++, таких как <string>
, <stack>
, <bits/stdc++.h>
и т. Д., Не дает никакого вывода. Но <iostream>
работает нормально.
Для <string>
Я также пытался std::string
в декларации.
Я включил C:\MinGW\bin
в свой путь.
#include <iostream>
#include <string>
using namespace std;
int main()
{
std::string str = "hello";
// string str = "hi";
cout << str;
}
Моя программа стека выглядит как
#include <iostream>
#include <stack>
using namespace std;
int main()
{
stack<int> s;
s.push(5);
cout << s.top();
}
Я проверил свою версию g ++ по
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.
В обоих случаях мой PowerShell выглядит следующим образом (powershell ничего не делает после ./hello.exe
):
![image](https://i.stack.imgur.com/RRXGE.png)