≡ Menu

gcc command

HowTo: Compile And Run a C/C++ Code In Linux

I am a new Linux user and student who used to write C or C++ programs on MS-Windows. Now, I am using Ubuntu Linux. How can I compile a C or C++ program on Linux operating systems using bash Terminal application?
[click to continue…]

Mac OS X: Install GCC Compiler with Xcode

I have Mac OS X Mountain Lion. I need to compile a few apps and Perl modules. I already installed Xcode from app store but I'm unable to find gcc compiler or make command. How do I install gcc on Mac OS X 10.8.x?
[click to continue…]

I've multiple version of gcc installed on my systems as follows:

ls -l /usr/bin/gcc*
lrwxrwxrwx 1 root root 7 Jan 11 05:20 /usr/bin/gcc -> gcc-4.4
-rwxr-xr-x 1 root root 239528 Sep 21 2010 /usr/bin/gcc-4.3
-rwxr-xr-x 1 root root 255536 Nov 15 2010 /usr/bin/gcc-4.4

I need to build a nvidia device driver using the same version of GNU compiler as was used to compile the currently running kernel. How do I find out the version of my GNU gcc compiler that was used by upstream Linux distribution to compile and pack my binary Linux kernel?
[click to continue…]

I'm trying to compile mini_sendmail as described here. But I'm getting the following error after tying the make command:

gcc -O -c mini_sendmail.c
gcc -O -s -static mini_sendmail.o -o mini_sendmail
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make: *** [mini_sendmail] Error 1

How do I fix this problem under RHEL 6?
[click to continue…]

How you can run a c program in Linux?

Q. I've a c program and I'd like to run in Linux.

A. C program need to compile and run in Linux using cc or gcc command. When you invoke GCC (GNU C Compiler), it normally does preprocessing, compilation, assembly and linking for you. For example to compile hello.c program , type the following command:
cc -o hello hello.c
OR
gcc -o hello hello.c

It will compile and produced an exectuable file called hello. To run program type:
./hello

How do I compile C program and create an executable file under Linux or UNIX operating systems?
Sample Unix C Program
[click to continue…]