Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-28-2003, 08:29 PM   #1
Registered: Oct 2003
Location: Pico
Distribution: SUSE 9.1
Posts: 83

Rep: Reputation: 15
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?).
Old 10-28-2003, 08:32 PM   #2
Registered: Oct 2003
Location: Pico
Distribution: SUSE 9.1
Posts: 83

Original Poster
Rep: Reputation: 15
also how is it possible to compile my code into a win32 app if needed?
Old 10-28-2003, 10:30 PM   #3
Registered: Oct 2003
Location: Canada
Posts: 736

Rep: Reputation: 57
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.
Old 10-29-2003, 03:20 AM   #4
Registered: Feb 2002
Location: Basque Country
Distribution: Fedora 14, Ubuntu 14.04
Posts: 434
Blog Entries: 1

Rep: Reputation: 55
man gcc
example for compiling a c program:

gcc helloworld.c -o helloworld

then you can execute like this:

-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.
Old 10-29-2003, 03:05 PM   #5
Registered: Oct 2003
Location: Pico
Distribution: SUSE 9.1
Posts: 83

Original Poster
Rep: Reputation: 15
Thanks very much. ;-)
Old 10-29-2003, 03:17 PM   #6
Registered: Oct 2003
Location: southern cali
Distribution: fedora core 4
Posts: 79

Rep: Reputation: 15
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 03:13 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 12:38 PM
running software built with gcc 3.0.2 on Redhat 8 - gcc 3.2 dst1989 Linux - Software 3 03-08-2004 11:23 PM
a doubt with host gcc and arm-linux-gcc renjithgopal Linux - General 1 09-11-2003 05:02 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 01:07 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration