Apps :: IDE C



Hello I am learning c and would like to be able to complie aplications that I make and use some kind of editor that understands the language so can highlight apropriatly on my laptop that runs DSL.  On windows I use Dev-c++ which apears to work fine so something like that would be best.  My laptop isn't very fast (266mhz 196mb ram 4gb HD).

Also will I have to change my programs so they can run inside linux ? currently there very simple and are only use ansi complatible functions (is that the correct phrase??) anyway I will inculde an example of my source code to clarify:

Quote

/* total cost calculator - calculates the price of items */
#include <stdio.h>
main()
{
     float base, vat = 1.175, post, final;
     
     printf("\nItem Calc - with beeps!");
     
     printf("\a\nPlease input the the base price of the item: ");
     scanf(" %f", &base);
     
     printf("\a\nPlease input the postage+packing charge: ");
     scanf(" %f", &post);
     
     final = (base * vat) + post;
     
     printf("\a\nThe total is: %.2f", final);
     return 0;
}

/* don't forget the apersands! */


I started to learn c because it's what the linux kernel is wrote in and I rearly want to be able to help out one day  :)

Not an IDE but....

Use Beaver or Nano editor to change your
#include <stdio.h>

to

#include <tcclib.h>

Then compile with tcc

tcc -o totcost  totcost.c

tcc is built into DSL and is OK for small programs like this.
Later you can use the extension that provides gcc
But with a slow computer you can have fun with tcc

There is a tcc tutorial in the download - current - documentation section.

If you don't wish to use tcc, you could use a fully featured compiler... one of the gcc* extensions would be ideal.

If I remember, beaver has syntax highlighting (though not sure of the defaults in DSL), but it's just an editor.  For an IDE I've used KDevelop, but it's rather heavy on resources.  Personally, I prefer using vim with syntax highlighting, autotabbing, etc.  Here's a list that could be handy: http://linuxmafia.com/faq/Devtools/ides.html

Some misc notes on your code (subject to opinion?):
- specify the return type i.e. int main
- no newline at the end of the last printf?
- it's ampersand ;p

I think I already have gcc installed so I mayaswell use that, with gcc can I use the <stdio.h> header file still or it there a different one to use?
I'm not sure what is ment by "specify the return type i.e. int main", could you give an example?

Quote
I'm not sure what is ment by "specify the return type i.e. int main"
Specify what type of data will be returned by a function. In the case of main, it is always (or nearly always?) going to be an integer. So instead of using "main()" you use "int main()"

Next Page...
original here.