Click to See Complete Forum and Search --> : gcc c++ compile problems (n00b)


mikenX
06-07-2003, 07:34 PM
I'm just starting to learn c++ and i'm got mandrake linux 9.0, using gcc to compile the c++.
I've made my first file to be compiled (hello world :D) but when i try to compile it using the command : g++ hello.C -o hello i get a whole lot of error messages:eg
hello.C:35: stray '\5' in program
hello.C:35:218: warning: null character(s) ignored
hello.C:35: stray '\1' in program
hello.C:35:221: warning: null character(s) ignored
hello.C:35: stray '\23' in program
hello.C:35:225: warning: null character(s) ignored
hello.C:35:225: warning: no newline at end of file

I've installed all packages i think were necessary for compiling c++ in linux but nothings changed.
i checked my gcc version using gcc --version (i think) and i hav version 3.2.

any ideas on whats wrong?
i'm pretty sure it isnt just an error in the hello.C file that i wrote (using openoffice.org writer)

rid3r
06-07-2003, 07:47 PM
I think that's exactly the problem, that OpenOffice inserted some formatting characters into your code.

bwkaz
06-07-2003, 08:48 PM
You need to be using g++ instead of gcc to compile C++, too -- but that won't cause this problem. This problem is caused by illegal characters in your C++ file -- use a real text editor, rather than a word processor. For example, try kedit, gedit, gvim perhaps, or xedit.

mikenX
06-07-2003, 09:32 PM
OMG of course
thanks :D