LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Help with Compiling and what's a good application to program with? (https://www.linuxquestions.org/questions/programming-9/help-with-compiling-and-whats-a-good-application-to-program-with-275992/)

johnnyICON 01-10-2005 03:32 AM

Help with Compiling and what's a good application to program with?
 
Hi I was wondering whats a good program to program with? I am mainling dealing with C++ files, but I am about to learn C.

I currently have nedit, but I am not too sure how to compile files with Linux either. I have only developed applications in Windows, so I am pretty much lost.

I am trying to compile the following code.

FileName: test.cpp
Code:

#include <iostream>

int main()
{
    cout << "test";
   
    return 0;
}

I typed in the console:
Code:

g++ test.cpp
and I get no output. :( Help

bigearsbilly 01-10-2005 04:33 AM

hint:
use make in built rules for simple stuff
'make test'
see what you get

jlliagre 01-10-2005 05:38 AM

another hint:
Code:

using namespace std;

bigearsbilly 01-10-2005 05:43 AM

and - you probably have got output.
look for a file a.out which is the default
output file name for the compiler.
(don't ask me why!)

using make like I mentioned earlier
will fix this behaviour.

say you have

Code:

file_name.c

make file_name

will produce an executable file called file_name

jlliagre 01-10-2005 05:45 AM

Quote:

and - you probably have got output.
look for a file a.out which is the default
output file name for the compiler.
(don't ask me why!)
a.out = Assembler OUTput ...

bigearsbilly 01-10-2005 05:47 AM

cheers for the info!

How long does it take before one's brain becomes
full up?

jlliagre 01-10-2005 06:17 AM

Quote:

How long does it take before one's brain becomes full up?
It can't, the brain is leaking faster that it fills after a while ... ;)

johnnyICON 01-10-2005 07:24 PM

So the way I was doing it (g++ <filename>) isn't the way to compile C++ files?

Also, what applications do you guys use when writing code?

jlliagre 01-11-2005 01:38 AM

Quote:

So the way I was doing it (g++ <filename> ) isn't the way to compile C++ files?
It is *one* way, but as you do not tell the compiler the name of the output file, it defaults to a.out which is probably not be what you want.
When your code is growing (multiple source files, dependancies, hierarchies, libraries, ...), you'll find that calling the compiler on the command line start to be a burden, and using a Makefile or an IDE greatly simplify the process.
Quote:

Also, what applications do you guys use when writing code?
I use elvis (a vi clone) and from time to time netbeans, but this is a domain where you have a very large choice (and religious wars too).

bigearsbilly 01-11-2005 03:35 AM

Jilliagre is correct.
I think 99% of the time people use make.
(it easier to type 'make test' than 'gcc test.o -o test' :-)

I just use a few standard Makefile templates
which I copy where I need them.
make is worth getting to know though it can be
very (VERY) frustrating to get familiar with it!

editor, I use vi!

chrism01 01-12-2005 12:08 AM

If you got the 'vi' type route, try vim (vi Improved). Free to download :-)
Has syntax highlighting amongst other goodies..

jlliagre 01-12-2005 02:02 AM

elvis is also open source, free to download, has syntax coloring, plus: has man-page and html modes (à la linx) and is more compatible with the standard vi.


All times are GMT -5. The time now is 05:56 PM.