Notices
Computer/Internet Issues & Troubleshooting Anyone with questions about the terribly complex world of computers or the internet should try here. NOT FOR REPORTING ISSUES WITH PPRuNe FORUMS! Please use the subforum "PPRuNe Problems or Queries."

doing C

Old 23rd September 2010 | 14:55
  #1 (permalink)  
Thread Starter
20 Anniversary
 
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...
rans6andrew is offline  
Reply
Old 23rd September 2010 | 15:03
  #2 (permalink)  
 
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 !
mixture is offline  
Reply
Old 23rd September 2010 | 19:37
  #3 (permalink)  
50 Countries Visited
20 Anniversary
 
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!
izod tester is offline  
Reply
Old 23rd September 2010 | 19:40
  #4 (permalink)  
 
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
Simonta is offline  
Reply
Old 23rd September 2010 | 21:03
  #5 (permalink)  
bnt
15 Anniversary
 
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:
Code:
/* hello.c: display a message on the screen */

#include <stdio.h>
 main()
{
 printf("hello, world\n");
}
you compile it with
Code:
gcc -o hello hello.c
and run it with command
Code:
./hello
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.
bnt is offline  
Reply
Old 23rd September 2010 | 22:18
  #6 (permalink)  
 
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
Too true.
at least better than the command line
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.
Gertrude the Wombat is offline  
Reply
Old 24th September 2010 | 04:16
  #7 (permalink)  
15 Anniversary
 
Joined: Jan 2008
Posts: 1,549
Likes: 63
From: UK
Originally Posted by Gertrude the Wombat
Too true.

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.

The various Visual Studio Express editions are free - but of course not available on Ubuntu etc.
cats_five is offline  
Reply
Old 24th September 2010 | 10:42
  #8 (permalink)  
 
Joined: Jan 2006
Posts: 130
Likes: 0
From: UK
Well, possibly, on a good day.
Yeh, fair comment.

Everybody I know who's tried both reckons Visual Studio to be miles and miles ahead. Sometimes you get what you pay for.
I use both pretty much everyday and VS is way ahead. I reckon I get 2-3 times as much code cut in VS than in Eclipse. I looked into reconfiguring VS for Android development but there is so much I'd lose (like IntelliSense) that I might as well continue to struggle in Eclipse. Oh, the pain. Eclipse AND Java - yeuch.

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.
Simonta is offline  
Reply
Old 24th September 2010 | 12:34
  #9 (permalink)  
Thread Starter
20 Anniversary
 
Joined: Sep 2004
Aviation Qualifications: PPL
Posts: 883
Likes: 34
From: Berkshire, UK
ta everyone, looks like the weekend might give me a break to get stuck in. Fingers crossed.

Rans6..
rans6andrew is offline  
Reply
Old 24th September 2010 | 20:19
  #10 (permalink)  
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
batninth is offline  
Reply
Old 24th September 2010 | 22:16
  #11 (permalink)  
 
Joined: Nov 2000
Posts: 3,443
Likes: 1
From: Cambridge, England, EU
Eclipse AND Java - yeuch
Yeah .... ... 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.
Gertrude the Wombat is offline  
Reply
Old 26th September 2010 | 00:10
  #12 (permalink)  
bnt
15 Anniversary
 
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.
bnt is offline  
Reply

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Thread Tools
Search this Thread

Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service

Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.