New to C Programming in UNIX environment


 
Thread Tools Search this Thread
Top Forums Programming New to C Programming in UNIX environment
# 1  
Old 07-19-2006
New to C Programming in UNIX environment

Hi all,

I know the basics of C programming, but I dont know a single thing about how to write, compile and run C code in UNIX, also where liberaris are stored, how .headers files are being managed in unix, how to debug c code and what are the available GNU tools for c programming in linux env, and what are the advantages of c programming in unix env.

Can any body give me the start. Thnx in advance.

Cheers,
Patras
# 2  
Old 07-19-2006
Lets see, you can write code in unix with any of the myriad of text editors available - try to familiarise yourself with either the vi or the emacs editors. For compiling code, you can use the GCC (have to install it seperately - though it will usually be available on Linux by default). Many systems come with their native C compilers, like Sun Studio on Sun or HP's HP C compiler.

On almost all systems, the libraries are available under /usr/lib, while includes are under /usr/include. Both libraries and include files specific to a certain products may be installed elsewhere during product installation as well.

As for debugging, you can use GDB which is part of the GCC. For more info on GCC, go here.
# 3  
Old 07-19-2006
Thanks for your reply. So it means path for header and liberary files is setup in system kernel at the time of installation? Because I never configured any path and compiled my first program with cc today and it went thru.

I dont have gcc installed, is there any major difference btw cc and gcc? Or initially I can continue with cc only. Any documentation is available for cc? I tried to understand the man page but not satisfactory, any good debugger link also pls.

thanks in advance.

cheers,
Patras
# 4  
Old 07-19-2006
What OS are you working on? That may tell you what native C compiler you've used. Also, check the output for 'ls -l `which cc`'. (Note the backquotes around 'which'). You may find that cc is actually a link to gcc (quite common). As for the documentation, is it for learning C or learning how to use cc/gcc? For C and debugging links, check the Unix Tutorials/Programming Tutorials/Shell Scripting Tutorials page.

In fact, I think that should answer almost all your questions. And one more piece of advice... check the FAQs page. You will get tutorials, recommended pages, ready-made scripts and more.
# 5  
Old 07-19-2006
Thanks for your reply. I'm at SCO Unixware, here is the output of which command:
Code:
$ ls -l `/usr/ucb/which cc`
lrwxrwxrwx    1 root     sys              15 Apr 16  2002 /usr/bin/cc -> /usr/ccs/bin/cc

I think its cc only not a link to gcc, I'll go thru FAQ's also.

Thanks for all your help.

Cheers,
Patras
# 6  
Old 07-19-2006
Quote:
Originally Posted by patras
Thanks for your reply. So it means path for header and liberary files is setup in system kernel at the time of installation?
close, not in the kernel, but in gcc itself.
Quote:
Because I never configured any path and compiled my first program with cc today and it went thru.
Which is as it should be.[quote]I dont have gcc installed, is there any major difference btw cc and gcc?
Quote:
Or initially I can continue with cc only. Any documentation is available for cc? I tried to understand the man page but not satisfactory, any good debugger link also pls.
cc and gcc ought to understand some of the same options, but not all of them. The -o, -I, -l, and -L flags ought to work the same.
# 7  
Old 07-21-2006
my CC link.

Quote:
Originally Posted by patras
Thanks for your reply. I'm at SCO Unixware, here is the output of which command:
Code:
$ ls -l `/usr/ucb/which cc`
lrwxrwxrwx    1 root     sys              15 Apr 16  2002 /usr/bin/cc -> /usr/ccs/bin/cc

I think its cc only not a link to gcc, I'll go thru FAQ's also.

Thanks for all your help.

Cheers,
Patras

On my solaris 9, its:
lrwxrwxrwx 1 root other 14 Feb 7 12:03 /opt/SUNWspro/bin/CC -> ../prod/bin/CC
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep problem from The Unix Programming Environment

Hi Here is the problem ( Exercise 3-3, Using The Shell of The Unix Programming Environment, Kerninghan, Pike, 3rd edition ): Predict what each of the following grep commands will do, and then verify your understanding. grep \$ grep \\$ grep \\\$ grep '\$' grep '\'$' grep \\ grep \\\\... (3 Replies)
Discussion started by: dum_dum20
3 Replies

2. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

3. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

4. UNIX for Dummies Questions & Answers

unix environment

Hi, Can anyone recommend a site where one can practise UNIX scripting . I don't have UNIX on my machine however I have heard there are some sites which let you log on to their servers for free. Thanks Rohit (2 Replies)
Discussion started by: rohitv
2 Replies

5. Shell Programming and Scripting

Unix Systems Programming Vs Unix Programming

Several months ago I found a link that explained the difference between how a Unix Systems Admin would do scripting compared to what a Unix Programmer would do. It showed a basic script and then show several iterations that explained how the Systems Admin would change it to make it better. I was... (0 Replies)
Discussion started by: BCarlson
0 Replies

6. Shell Programming and Scripting

programming for unix environment

i have to make a menu based program to allow iusers to select the system information about their machine that they want. All i have been taught is how to enter commands at the command prompt like simple commands such as pwd and cd directory to change directory (not even sure if that is right). But... (1 Reply)
Discussion started by: carlvernon
1 Replies

7. Programming

c programming or unix programming!?

i would like advice on the usbject of c programming (in the middle of reading a book on C). could i benefit more if i apply that knowledge in the unix format if i were able to, or would that take the point out of learning C, basically I want to stay away from strying too far away from unix and use... (1 Reply)
Discussion started by: moxxx68
1 Replies

8. Post Here to Contact Site Administrators and Moderators

Java Programming in UNIX Environment

A suggetion: Don't we need to start Java Programming in UNIX Environment Forum ? (1 Reply)
Discussion started by: cub
1 Replies

9. UNIX for Dummies Questions & Answers

MixWindows UNIX environment

I was wondering if anyone has had any experience in this area. The company that I work at is trying to bring a Windows 2000 server online and have the UNIX workstations and Clients connect to it like it is anothe UNIX box. They have been using Windows Services for UNIX to do this but are having... (1 Reply)
Discussion started by: kaikara1
1 Replies
Login or Register to Ask a Question

Featured Tech Videos