LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   gcc , cc , g++ (https://www.linuxquestions.org/questions/linux-newbie-8/gcc-cc-g-109689/)

Genjix 10-28-2003 07:29 PM

gcc , cc , g++
 
what do the switched -c and -o do?
Whats the difference between g++ , gcc and cc (and what are advantages of them?).

Genjix 10-28-2003 07:32 PM

also how is it possible to compile my code into a win32 app if needed?

wh33t 10-28-2003 09:30 PM

I'm no expert to C or C++ or linux, i just started using linux actually. But gcc i believe is gnu free compiler for C, g++ the gnu free compiler for C++ and cc... well you got me, i gots no idea. Hope that helps. Oh... and compiling programs for win32... I think you'd probably have to run Wine, or something. Hope that helps somehow.

aizkorri 10-29-2003 02:20 AM

try
man gcc
example for compiling a c program:

gcc helloworld.c -o helloworld

then you can execute like this:
./helloworld

-c Compile or assemble the source files, but do not
link. The compiler output is an object file corre_
sponding to each source file.

-o file
Place output in file file. This applies regardless
to whatever sort of output GCC is producing,
whether it be an executable file, an object file,
an assembler file or preprocessed C code.

Genjix 10-29-2003 02:05 PM

Thanks very much. ;-)

paperdiesel 10-29-2003 02:17 PM

g++ is the compiler for c++, gcc is for c, and I don't think cc is a compiler at all.

if you code something in c++, to run it do something like this:

./g++ -o [executable] [source]

so it would look like:

./g++ -o foo foo.cpp

-o specifies the name out of the ouput file (if you don't use it, your output file is, be default, named "a.out").

as mentioned before, -c just compiles it and doesn't link it (good for quick debugging purposes).

hope this helps
ti


All times are GMT -5. The time now is 07:10 PM.