Hello. I do not know when and how to use this
$ CC -I/usr/local/include main.cpp
Do I use this before g++ or after or together in cmd line?
In makefiles CC is often defined to be the "C compiler" (e.g. gcc) and CXX to be the "C++ compiler" (e.g. g++).
If you are running this from the command line I guess you should simply replace CC with g++.
on Solaris, CC is the name of the C++ compiler, so that line works as-is
On Solaris, lowercase cc is the native compiler. (And on most old nixen.)
No one has commented on the inanity of having to explicitly list the default include path? You should be able to properly compile with just
$ cc main.cpp
If that has problems, contact your school's admin and ask why it is broken.
Eh? lowercase cc is the C compiler, uppercase CC is the C++ compiler. I use this thing every day.
/me slaps head
Yes, of course. Sorry about that.
What is this I/usr/local/include ?
It tells the compiler where to find its standard include files (like <iostream> and <string>).
And like I said, you shouldn't have to do that. (Not for that directory.)