doing C
Thread Starter

Joined: Sep 2004
Aviation Qualifications: PPL
Posts: 883
Likes: 34
From: Berkshire, UK
doing C
some years ago, in a previous life, I dabbled in C programming on a Sun Unix workstation. Got to the point where I could solve mathematical brain teasers, write "hello whirled" on the screen and sort a file to count all of the 4 letter words etc.
More recently I have been writing C for a PIC microcontroller and didn't find it too steep a learning curve.
Anyway, I run Ubuntu10 on my desktop machine and I understand that this was written in C. Also, it would seem likely that there is some C compiler available with my Ubuntu install.
I have a simple text editor (gedit) and can write the text. Does anyone know how to inspire the compiler (if there is one buried in Ubuntu) to turn my text into an executable code?
Thanks,
Rans6...
More recently I have been writing C for a PIC microcontroller and didn't find it too steep a learning curve.
Anyway, I run Ubuntu10 on my desktop machine and I understand that this was written in C. Also, it would seem likely that there is some C compiler available with my Ubuntu install.
I have a simple text editor (gedit) and can write the text. Does anyone know how to inspire the compiler (if there is one buried in Ubuntu) to turn my text into an executable code?
Thanks,
Rans6...
Joined: Aug 2002
Posts: 3,663
Likes: 0
From: Earth
I don't do Ubuntu, but I do other *nix/*nux and would assume the answer would be the same....
Have you not discovered gcc/make & friends ?
(i.e. already there, under your nose - "whereis/apropos/find make" - unless it's like SuSe which does not always automagically select "compiler tools" category during install
)
For more detailed compiler tutorial, see Google "ubuntu hello world c"
Good luck, and happy coding !
Have you not discovered gcc/make & friends ?
(i.e. already there, under your nose - "whereis/apropos/find make" - unless it's like SuSe which does not always automagically select "compiler tools" category during install
)For more detailed compiler tutorial, see Google "ubuntu hello world c"
Good luck, and happy coding !


Joined: Apr 2002
Posts: 199
Likes: 6
From: Forest of Dean
A standard Ubuntu install usually includes gcc. A good intro to compiling applications from source code is at:
https://help.ubuntu.com/community/CompilingEasyHowTo
Of course that article assumes you want to compile source code you obtain from somewhere else, whilst you intend to roll your own!
https://help.ubuntu.com/community/CompilingEasyHowTo
Of course that article assumes you want to compile source code you obtain from somewhere else, whilst you intend to roll your own!
Joined: Jan 2006
Posts: 130
Likes: 0
From: UK
You might want to try Eclipse? It's a complete IDE. A pig to use but at least better than the command line.
Eclipse IDE for C/C++ Developers | Eclipse Packages
Eclipse IDE for C/C++ Developers | Eclipse Packages

Joined: Feb 2007
Posts: 755
Likes: 26
From: Dublin, Ireland. (No, I just live here.)
I did a basic C / C++ course at university, and compiled some of my programs on this Ubuntu Netbook. The base compiler is called gcc, but I don't think it is installed by default, since it pulls in a bunch of other stuff too. If not, just do a "sudo apt-get install gcc" to install it.
With this code in hello.c:
you compile it with
and run it with command
NB: the -o parameter sets the output executable name. If you're writing C++, use g++ instead of gcc, but I generally used g++ for everything, even plain C.
With this code in hello.c:
Code:
/* hello.c: display a message on the screen */
#include <stdio.h>
main()
{
printf("hello, world\n");
}
Code:
gcc -o hello hello.c
Code:
./hello
Joined: Nov 2000
Posts: 3,443
Likes: 1
From: Cambridge, England, EU
You might want to try Eclipse? It's a complete IDE. A pig to use
at least better than the command line
Everybody I know who's tried both reckons Visual Studio to be miles and miles ahead. Sometimes you get what you pay for.

Joined: Jan 2008
Posts: 1,549
Likes: 63
From: UK
Joined: Jan 2006
Posts: 130
Likes: 0
From: UK
Well, possibly, on a good day.
Everybody I know who's tried both reckons Visual Studio to be miles and miles ahead. Sometimes you get what you pay for.
If only googoo would build the ADT for VS - reckon they'd do themselves a favour by opening up a far more competent IDE to a new set of devs.
I would pay serious money for an IDE for Android.
Oh Shazbat!
Joined: Feb 2004
Posts: 239
Likes: 0
From: Leeds, UK
Hi Rans6...
You may need to download the various development tools on Ubuntu, but the Synaptic Package Manager will take care of all that for you. I tend to go into Synaptic then use the Search & look at what's available. Synaptic will install any dependencies as well.
The Ubuntu repositories also have a few IDEs available, again downloadable via Synaptic. I see some mention of Eclipse elsewehere, but I'd suggest you take a look at NetBeans which has a number of tutorials on the NetBeans web site.
If you are interested in erring towards the Microsoft way, then Mono is also available via Synaptic. Mono, which has its roots in Novell (but MS have a hand in it) is a .NET(-ish) implementation on Linux and includes a C# compiler.
Finally there are some good online books around, the "Think like a Computer Scientist" series are around in various places, and Bruce Eckel books include a C one somewhere
Anyway, have fun
You may need to download the various development tools on Ubuntu, but the Synaptic Package Manager will take care of all that for you. I tend to go into Synaptic then use the Search & look at what's available. Synaptic will install any dependencies as well.
The Ubuntu repositories also have a few IDEs available, again downloadable via Synaptic. I see some mention of Eclipse elsewehere, but I'd suggest you take a look at NetBeans which has a number of tutorials on the NetBeans web site.
If you are interested in erring towards the Microsoft way, then Mono is also available via Synaptic. Mono, which has its roots in Novell (but MS have a hand in it) is a .NET(-ish) implementation on Linux and includes a C# compiler.
Finally there are some good online books around, the "Think like a Computer Scientist" series are around in various places, and Bruce Eckel books include a C one somewhere
Anyway, have fun
Joined: Nov 2000
Posts: 3,443
Likes: 1
From: Cambridge, England, EU
Eclipse AND Java - yeuch


... trouble is that's mostly what I get paid for these days.Never mind, there's someone wanting to pay me to spend Sunday writing C++ with VS ... now is that a
or
I wonder ...Wha'ever, if I do some weekend work at least I don't get complained at about how much I spend on flying, for a little while at least.

Joined: Feb 2007
Posts: 755
Likes: 26
From: Dublin, Ireland. (No, I just live here.)
IDE? Pshaw! All you need is gedit, g++, and a web browser open to cplusplus.com - The C++ Resources Network. You may as well go straight to the C++ compiler, even if you write plain C and don't hold with that fancy object-orientation stuff.




