我想執行這個代碼nmea2kml.cpp的.cpp錯誤:敵不過「運營商<」中「的std :: CERR <‘轉換文件’「」
,但我不斷收到以下錯誤也該程序有命令行參數-f path Read file at given path (e.g. /some/where/nmea.txt)
我應該改變什麼來運行程序?我是否因爲編譯器問題而得到錯誤?因爲我已經搞錯了添加cygwin,MinGW編譯器到eclipse !!我知道程序是正確的。另一些人用它,並得到了結果。(http://julien.cayzac.name/code/gps/)
錯誤
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\nmea.o ..\src\nmea.cpp
..\src\nmea.cpp: In function `int main(int, char**)':
..\src\nmea.cpp:195: error: no match for 'operator<' in 'std::cerr < "Converting file \""'
..\src\nmea.cpp:195: note: candidates are: operator<(const char*, const char*) <built-in>
..\src\nmea.cpp:195: note: operator<(void*, void*) <built-in>
..\src\nmea.cpp:336: error: no match for 'operator<' in 'std::cout < "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"'
..\src\nmea.cpp:336: note: candidates are: operator<(const char*, const char*) <built-in>
..\src\nmea.cpp:336: note: operator<(void*, void*) <built-in>
..\src\nmea.cpp:336: error: `std::endl(std::basic_ostream<_CharT, _Traits>&)' cannot appear in a constant-expression
..\src\nmea.cpp:355: error: parse error in template argument list
..\src\nmea.cpp:336: error: `endl<<expression error> >' cannot appear in a constant-expression
..\src\nmea.cpp:406: error: parse error in template argument list
..\src\nmea.cpp:336: error: `endl<<expression error> >' cannot appear in a constant-expression
..\src\nmea.cpp:406: error: parse error in template argument list
..\src\nmea.cpp:336: error: `endl<<expression error> >' cannot appear in a constant-expression
..\src\nmea.cpp:406: error: parse error in template argument list
..\src\nmea.cpp:406: error: expected `;' before '}' token
..\src\nmea.cpp:193: warning: unused variable 'outfile'
Build error occurred, build is stopped
我試過了!但它顯示.. 在函數'int main(int,char **)'中: (std :: basic_ostream>&)(+(+)+ std :: operator << [with _Traits = std :: char_traits ](((std :: basic_ostream >&)(+(+ std :: operator << [with _Traits = std: :char_traits ] ..main.cpp | 347 |錯誤:'filename'不能出現在常量表達式中| ..main.cpp | 347 |錯誤:'std :: endl(std :: basic_ostream <_CharT, _Traits>&)'不能出現在常量表達式中| –
emil
yes!現在解決!非常感謝! – emil