[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New to g++ and linux - Class path problem?
From: |
Matt |
Subject: |
Re: New to g++ and linux - Class path problem? |
Date: |
Sun, 28 Oct 2001 21:21:35 +0000 |
>From: "Todd Hoffman" <Todd@HoffmanNet.com>
>Subject: New to g++ and linux - Class path problem?
>Date: Thu, 25 Oct 2001 16:10:46 -0700
>I am doing some C++ programming on this machine, and I can compile my source
>just fine, and g++ creates an a.out file.
>I am in the directory that contains the a.out file, and I type a.out. I get
>an error message that says command cannot be found.
Hi Todd,
As I understand it, you basically need to follow these steps:
1) Ensure gcc is correctly installed on your machine - it sounds like it
probably is on yours, since it compiles to a.out at all.
2) CD to the directory where your C source files reside
3) Write or locate your source code, eg. <testprog.c>
4) From shell, type gcc -o <testprog> <testprog.c> [enter]
This will directly create the binary executable 'testprog' from the source
code 'testprog.c' . I find it clearer to give executable files a name
immediately, other than the default 'a.out' every time.
You can then run it from the shell by typing ./testprog (that's
dot,slash,testprog [enter] - at leat that works for me in Linux Mandrake).
Best wishes,
Matt Rhys-Roberts
North Wales