Am about to get serious about studying and learning C++, and the C++ Language FAQ under the heading Information on this web page provides a test to check if my compiler recognizes ANSI-C++ features. I copied and pasted their example to Code::Blocks and it came up with these errors in the terminal...
2: using: not found
3: Syntax error: newline unexpected
When you create a new project, you can choose between C and C++.
By the way, the current version of Code::Blocks is 10.05, which comes with a truly up-to-date compiler.
You got me good - can't find anywhere to designate the project as C++.
Ubuntu still has their most recent v as 8.02 in synaptic.
Just thought I'd run the quick test, but find that maybe IDE's require a learning curve as well, so I guess I'll do some more studying.
Thanks for your help, Athar.
You want to use GNU g++ not gcc. gcc is the C compiler, g++ is the C++ compiler.
Also, the error 'newline expected' is because you didn't include a newline at the end of your code. Put one after the very last bracket at the bottom of the file.
If you use g++ and have a newline at the end (if it doesn't, not a big deal though. g++ will treat it as a warning not an error) it will work.
Edit: Sorry, it says 'newline Unexpected' not expected... I would figure that is from trying to use gcc to compile... Though like I said, you'll get a warning if you don't have a newline at the EOF.
Worst comes to worst, you can just forget compiling from within the IDE, and do it from CL... i.e.
Thanks folks for the homework :) I'll get back to you tomorrow after I get some studying done. Will give the terminal a go, also. Lots say to get used to g++ from the terminal, so I might as well dive in and get it down.
Good night
You could also give Eclipse a try. I know for fact that it works well. You can create a C++ specific project, or C. Also comes in several other languages. Make sure to install the C++ version of Eclipse.
Twud be simple if not for 1st day experience in C++ exposure, but by saving the file with .cpp extension forces Code::Blocks to compile in g++.
hahahaha :) m learning,eh?