I'm trying to execute the following code in netbeans & eclipse but without success.
http://read.pudn.com/downloads150/sourcecode/comm/651136/NmeaConverter.cpp__.htm
Program has command-line parameter: -f D:\nmea.txt

Eclipse says:

Description	Resource	Path	Location	Type
`endl<<expression error> >' cannot appear in a constant-expression	nmea.cpp	/nmea/src	line 358	C/C++ Problem
`std::endl(std::basic_ostream<_CharT, _Traits>&)' cannot appear in a constant-expression	nmea.cpp	/nmea/src	line 358	C/C++ Problem
expected `;' before '}' token	nmea.cpp	/nmea/src	line 428	C/C++ Problem
no match for 'operator<' in 'std::cerr < "Converting file \""'	nmea.cpp	/nmea/src	line 217	C/C++ Problem
no match for 'operator<' in 'std::cout < "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"'	nmea.cpp	/nmea/src	line 358	C/C++ Problem
parse error in template argument list	nmea.cpp	/nmea/src	line 377	C/C++ Problem
parse error in template argument list	nmea.cpp	/nmea/src	line 428	C/C++ Problem
Invalid project path: Duplicate path entries found (/nmea [Include path] isSystemInclude:true includePath:C:/MinGW/include), path: [/nmea].	nmea		pathentry	Path Entry Problem
Invalid project path: Include path not found (C:\MinGW\lib\gcc\mingw32\4.5.2\include-fixed).	nmea		pathentry	Path Entry Problem
Invalid project path: Include path not found (C:\MinGW\lib\gcc\mingw32\4.5.2\include).	nmea		pathentry	Path Entry Problem
Invalid project path: Include path not found (C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++).	nmea		pathentry	Path Entry Problem
Invalid project path: Include path not found (C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\backward).	nmea		pathentry	Path Entry Problem
Invalid project path: Include path not found (C:\MinGW\lib\gcc\mingw32\4.5.2\include\c++\mingw32).	nmea		pathentry	Path Entry Problem
unused variable 'outfile'	nmea.cpp	/nmea/src	line 215	C/C++ Problem
                operator<(void*, void*) <built-in>	nmea.cpp	/nmea/src	line 217	C/C++ Problem
                operator<(void*, void*) <built-in>	nmea.cpp	/nmea/src	line 358	C/C++ Problem
candidates are: operator<(const char*, const char*) <built-in>	nmea.cpp	/nmea/src	line 217	C/C++ Problem
candidates are: operator<(const char*, const char*) <built-in>	nmea.cpp	/nmea/src	line 358	C/C++ Problem

Netbeans says,

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/***/Documents/NetBeansProjects/NMEA'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/nmea.exe
make[2]: Entering directory `/c/Users/***/Documents/NetBeansProjects/NMEA'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++    -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
main.cpp: In function `int main(int, char**)':
main.cpp:209: error: no match for 'operator<' in 'std::cerr < "Converting file \""'
main.cpp:209: note: candidates are: operator<(const char*, const char*) <built-in>
main.cpp:209: note:                 operator<(void*, void*) <built-in>
main.cpp:209: error: `nmea' was not declared in this scope
main.cpp:350: error: no match for 'operator<' in 'std::cout < "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"'
main.cpp:350: note: candidates are: operator<(const char*, const char*) <built-in>
main.cpp:350: note:                 operator<(void*, void*) <built-in>
main.cpp:350: error: `std::endl(std::basic_ostream<_CharT, _Traits>&)' cannot appear in a constant-expression
main.cpp:369: error: parse error in template argument list
main.cpp:350: error: `endl<<expression error> >' cannot appear in a constant-expression
main.cpp:420: error: parse error in template argument list
main.cpp:350: error: `endl<<expression error> >' cannot appear in a constant-expression
main.cpp:420: error: parse error in template argument list
main.cpp:350: error: `endl<<expression error> >' cannot appear in a constant-expression
main.cpp:420: error: parse error in template argument list
main.cpp:420: error: expected `;' before '}' token
main.cpp:420:5: warning: no newline at end of file
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/Users/***/Documents/NetBeansProjects/NMEA'
make[1]: Leaving directory `/c/Users/***/Documents/NetBeansProjects/NMEA'

BUILD FAILED (exit value 2, total time: 1s)

Not sure about Eclipse. It's most likely quite similar to NetBeans, though possibly with diferent categories and subcategoreies. All Projects will have a "Properties" option, with a bunch of sub-options. In NetBeans, right-click your C++ project and select "Properties". Select the "Run" category from within "Properties". Within "Run", Select "General" (it's the only option). Within "General", there is an option called "Arguments". That's where you type in the command line arguments to be passed to the main function. Save it, recompile (recompile probably isn't necessary, but can't hurt), and run again.


[EDIT]
Wait a minute, those look like compiler errors. Runtime arguments are irrelevant if it doesn't compile. Is this a NetBeans-specific thread or a generic thread asking for help on C++ code?
[/EDIT]

Well, pretty much everywhere in the code, you use a single < where you need two (outputting with streams). That will fix your problem. And you also need to #include <cstring> to get the strlen function.

I replaced all < with << and it worked fine. Thanks very much everyone for the help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.