PDA

View Full Version : [SOLVED] Programming in C/++



createdcreature
July 13th, 2011, 05:13 PM
What should I use to program in C in Linux? I have absolutely no idea where to start! I am an expert in C, but not in what to compile it in Linux?

cgroza
July 13th, 2011, 05:19 PM
GCC and <insert IDE or editor here>. I recommend emacs...:)

TwoEars
July 13th, 2011, 05:21 PM
How can you manage to be an expert in C, and yet not be able to find a compiler for it?

http://en.wikipedia.org/wiki/List_of_compilers#C_compilers

The standard is gcc, but clang is up and coming.

Here is a list of IDEs, if you need them too -

http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments# C.2FC.2B.2B

Google, isn't it wonderful?

haqking
July 13th, 2011, 05:29 PM
What should I use to program in C in Linux? I have absolutely no idea where to start! I am an expert in C, but not in what to compile it in Linux?


an expert biut dont know how to compile it ?

gcc and vim

And a good book by the sounds of it ;-)

psusi
July 13th, 2011, 06:33 PM
+1 for emacs. It isn't as pretty or easy to figure out as visual studio, but it's a hell of a lot more powerful.

Npl
July 13th, 2011, 06:35 PM
Hes is more than an expert, he is a script himself (look at his location). None of his posts take anything said in the thread in context, even if it sometimes fits the topic.

cgroza
July 13th, 2011, 06:37 PM
Hes is more than an expert, he is a script himself (look at his location). None of his posts take anything said in the thread in context, even if it sometimes fits the topic.
I have this doubt ever since I saw his first post.

Npl
July 13th, 2011, 06:39 PM
I have this doubt ever since I saw his first post.More than just a doubt, if not he can prove me wrong, quote my post and say something thats more fitting than random fortune cookies for IT personal

createdcreature
July 14th, 2011, 06:47 AM
How do I compile a C++ command line program in Linux? I am an expert in C++, but not in compiling in Linux! This follows up to my 'Programming in C' thread.

stchman
July 14th, 2011, 07:19 AM
How do I compile a C++ command line program in Linux? I am an expert in C++, but not in compiling in Linux! This follows up to my 'Programming in C' thread.

Most of the time you will use the g++ command line compiler. What OS and what IDE did you use for your C++ development?

Alsp for Ubuntu, make sure you install build-essential.



sudo apt-get install build-essential

Elfy
July 14th, 2011, 07:23 AM
Merged.

createdcreature
July 14th, 2011, 12:28 PM
Ok. I will use GCC and G++.

createdcreature
July 25th, 2011, 09:39 AM
Working really well!

me@mypc: g++ program.cpp

me@mypc: ./a.out

Hello world!

createdcreature
July 28th, 2011, 04:52 PM
Just one question, can I distribute the binaries with Linux computers without gcc/g++ installed and Mac OS X users (because Mac OS X is basically FreeBSD)?

nvteighen
July 28th, 2011, 09:13 PM
Just one question, can I distribute the binaries with Linux computers without gcc/g++ installed and Mac OS X users (because Mac OS X is basically FreeBSD)?

The compiler isn't needed to run the executables, so there's no requirement to have gcc/g++ installed for that. But you ought to have the runtime libraries installed.

But: executable formats are different across OSs. Yes, Darwin (the system underlying Mac OS X) is based on FreeBSD, but uses a different kernel (XNU) and uses the Mach executable format. IIRC, FreeBSD mostly uses ELF.

Recompiling is the best bet.

psusi
July 29th, 2011, 03:33 PM
Yes, Darwin (the system underlying Mac OS X) is based on FreeBSD, but uses a different kernel (XNU) and uses the Mach executable format. IIRC, FreeBSD mostly uses ELF.


I never understand why people say this kind of thing. FreeBSD is a kernel, so saying that MacOS is based on FreeBSD, but using a different kernel, is complete nonsense. They have a microkernel based on Mach, on top of which they have implemented POSIX APIs. That doesn't have anything to do with FreeBSD, other than FreeBSD also implements POSIX APIs... as does Linux, and even Windows implements many of them.

nvteighen
July 29th, 2011, 05:21 PM
I never understand why people say this kind of thing. FreeBSD is a kernel, so saying that MacOS is based on FreeBSD, but using a different kernel, is complete nonsense. They have a microkernel based on Mach, on top of which they have implemented POSIX APIs. That doesn't have anything to do with FreeBSD, other than FreeBSD also implements POSIX APIs... as does Linux, and even Windows implements many of them.

FreeBSD isn't a kernel, but the name of an BSD-derived OS as a whole. It's a kernel and a userland... and is a completely different OS to e.g. Debian GNU/kFreeBSD (I guess the lowercase 'k' stays for "kernel"), which combines FreeBSD's kernel (which AFAIK, doesn't have a special name) with the GNU userland and Debian's official software.

Apple Darwin has its userland derived from FreeBSD's and its XNU kernel has some parts derived from FreeBSD's kernel, but also from the Mach kernel and others.

stchman
July 30th, 2011, 12:22 AM
I never understand why people say this kind of thing. FreeBSD is a kernel, so saying that MacOS is based on FreeBSD, but using a different kernel, is complete nonsense. They have a microkernel based on Mach, on top of which they have implemented POSIX APIs. That doesn't have anything to do with FreeBSD, other than FreeBSD also implements POSIX APIs... as does Linux, and even Windows implements many of them.

The Mach kernel contains parts from FreeBSD and NetBSD. Those parts were incorporated into NextSTEP which is the core of OS X. So OS X has underpinnings of FreeBSD.

createdcreature
July 30th, 2011, 09:27 AM
Isn't a.out the Linux binary system that was replaced ages ago by ELF, so all systems should have the runtime?

stchman
August 3rd, 2011, 12:19 AM
Isn't a.out the Linux binary system that was replaced ages ago by ELF, so all systems should have the runtime?

In gcc and g++ it is just the default filename if no name is specified.