Miscellaneous > Programming & Networking
learning C++
Faust:
OK now I'm learning C++ as well as eiffel.
Typing std::cout all the time is annoying, and according to the book I'm using I should be able to avoid this by putting "using std::cout;" or "using namespace std;" at the top of my program just below "int main()" and the "{". But when I go to do g++ program.cpp I get a compiler error -
--- Code: ---
--- End code ---
Is this just because I am using an old compiler? It's on my Universities Solaris boxes.
Heres the actual (no laughing this is my first day!) file:
--- Code: ---
--- End code ---
edit:everything bar the "using" lines is a copy of another file, cout_easy.cpp with the "std::" parts removed, and that compiled fine.
Also is there a nice way to compile it and have the binary come out with the same name as the source file minus the ".cpp"? It gets annoying having to do "mv a.out [new_name]" all the time.
[ May 11, 2003: Message edited by: Faust ]
slave:
I hate to break it to you, but that code compiled fine on my computer.
:confused:
Faust:
Damn old as Solaris boxes then. Bah! When will the computer sciences division invest in a newer gcc/g++?
Thanks Linux User, now I know it's not my fault. ;)
slave:
Weeaaak. What version of gcc do those computers have? (type g++ --version)
I just sshed to my univ's solaris mainframe and compiled that code just fine on it too. And I looked hard at it, and I can't figure out what the hell is wrong. Very odd.
slave:
quote:Also is there a nice way to compile it and have the binary come out with the same name as the source file minus the ".cpp"? It gets annoying having to do "mv a.out [new_name]" all the time.
--- End quote ---
sure.
> g++ -o somename somename.cc
Navigation
[0] Message Index
[#] Next page
Go to full version