I have no clue how to get g++ to run, I am pretty sure I have all the files installed (I found an old thread), but I really have no clue how to run anything under linux. Any help on running it?
I have no clue how to get g++ to run, I am pretty sure I have all the files installed (I found an old thread), but I really have no clue how to run anything under linux. Any help on running it?
What are you trying to do? Normally, you open a terminal
Code:g++ FILENAME.cpp -o BINNAME
CloudRck.com - Host on CloudRck
I sponsor open source projects and support users of such technologies. PM for details
thanks but I got an errorOriginally Posted by DJ_Max
when runningCode:jared@ubuntu:~$ g++ /home/jared/Desktop/firtprogram.cpp -o BINNAME In file included from /usr/include/c++/3.3/backward/iostream.h:31, from /home/jared/Desktop/firtprogram.cpp:3: /usr/include/c++/3.3/backward/backward_warning.h:32:2: warning: #warning This fi le includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples in clude substituting the <X> header for the <X.h> header for C++ includes, or <sst ream> instead of the deprecated header <strstream.h>. To disable this warning us e -Wno-deprecated. jared@ubuntu:~$
do you know what that means?Code:// my first program in C++ #include <iostream.h> int main () { cout << "Hello World!"; return 0; }
Last edited by jarg; August 6th, 2005 at 02:58 PM.
Try:Originally Posted by jarg
It looks like you just got a warning for using the old-style C++ headers. At the present, the C++ standard library uses "<foo>" includes where you see "<foo.h>" in older references. The namespace (std) is also important once you start using the new headers.Code:// my first program in C++ #include <iostream> int main () { std::cout << "Hello World!"; return 0; }
To add to what cwaldbieser said. He means adding
Code:using namespace std;
CloudRck.com - Host on CloudRck
I sponsor open source projects and support users of such technologies. PM for details
For toy programs, the [using] directive is OK. But once you start writing more complicated programs, it becomes better practice to forgo the [using] directive and just qualify your symbols. Especially in header files that you expect someone else to include. Otherwise, you just end up polluting the namespace.Originally Posted by DJ_Max
Or, qualify your symbols on a per-symbol basis, at the smallest reasonable scope (usually function-scope):Code:#include <iostream> int main() { using std::cout; using std::endl; cout << "Hello World" << endl; }
Bookmarks