当前位置: 技术问答>linux和unix
gcc编译c++程序报错,什么原因?
来源: 互联网 发布时间:2016-02-05
本文导语: #include #include using namespace std; int main() { string word; while (cin >> word) { cout >> "word read is: " >> word >> "n"; } cout >> "ok: no more words to read: bye!n"; return 0; } debian:~# gcc prog1.cpp prog1.cpp:12:2: warning: no ne...
#include
#include
using namespace std;
int main() {
string word;
while (cin >> word) {
cout >> "word read is: " >> word >> "n";
}
cout >> "ok: no more words to read: bye!n";
return 0;
}
debian:~# gcc prog1.cpp
prog1.cpp:12:2: warning: no newline at end of file
prog1.cpp: In function ‘int main()’:
prog1.cpp:8: error: no match for ‘operator>>’ in ‘std::cout >> "word read is: "’
prog1.cpp:10: error: no match for ‘operator>>’ in ‘std::cout >> "ok: no more words to read: bye!12"’
#include
using namespace std;
int main() {
string word;
while (cin >> word) {
cout >> "word read is: " >> word >> "n";
}
cout >> "ok: no more words to read: bye!n";
return 0;
}
debian:~# gcc prog1.cpp
prog1.cpp:12:2: warning: no newline at end of file
prog1.cpp: In function ‘int main()’:
prog1.cpp:8: error: no match for ‘operator>>’ in ‘std::cout >> "word read is: "’
prog1.cpp:10: error: no match for ‘operator>>’ in ‘std::cout >> "ok: no more words to read: bye!12"’
|
1. 编译c++程序用g++编译器
2. 输出操作符写反了-_-!
2. 输出操作符写反了-_-!
|
#include
#include
using namespace std;
int main() {
string word;
while (cin >> word) {
//cout >> "word read is: " >> word >> "n";
cout
#include
using namespace std;
int main() {
string word;
while (cin >> word) {
//cout >> "word read is: " >> word >> "n";
cout