programming in C


 
Thread Tools Search this Thread
Top Forums Programming programming in C
# 1  
Old 02-10-2009
programming in C

Hi Guys,

I am willing to write some programs in C/C++ for Solaris machine.
I am pretty good in C++ programming for PC.
But I have some questions, while starting programming in solaris.

1. Which one is the most suitable & easy to use compiler?
(Most probabaly I will use vi editor to edit programs, any suggestions welcomed)
2. From where I can get that compiler and how to install the compiler
3. From where I can get C/C++ libraries for Solaris/UNIX?
4. How to start compiling and running program?
5. Will those programs written portable on both LINUX/SOLARIS?

Regards
@Asteroid
# 2  
Old 02-10-2009
Quote:
Originally Posted by Asteroid
Hi Guys,

I am willing to write some programs in C/C++ for Solaris machine.
I am pretty good in C++ programming for PC.
But I have some questions, while starting programming in solaris.

1. Which one is the most suitable & easy to use compiler?
I'd suggest gcc. At its very simplest, gcc filename1.c -o filename can transform one C file into one executable. More complex options and methods are there to transform .c files into .o files, which can all be linked together into one executable. Try 'gcc --version' to see if you have it already.
Code:
(Most probabaly I will use vi editor to edit programs, any suggestions welcomed)

Text is text, the compiler doesn't care. Smilie Personally I prefer editors designed for keyboards newer than the ADM3A but tastes differ Smilie
Quote:
5. Will those programs written portable on both LINUX/SOLARIS?
Depends what you mean. A program compiled on solaris won't run on linux and vice versa, but proper C code using portable features should compile fine in either.
# 3  
Old 02-11-2009
Hi Guys,

Fortunately I have both machines, LINUX on HP Prolient and SUN on SPARC. Both has GCC compilers.

So, should I write source and compile same source on both machines separately to obtain two distributions of executable.

Or on the other hand write code in such a way if compiled on any of the machine(SUN) will work on the other (LINUX).

which approach is appropriate. Will the 1st approach will work?
What you guys suggest.

SUN:
Quote:
root@M1 # gcc --version
gcc (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@M-01 # uname -a
SunOS M 5.10 Generic_127112-10 i86pc i386 i86pc Solaris
You have new mail in /var/mail//root
LINUX:

Quote:
[root@mrbtselfcare ~]# gcc --version
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@mrbtselfcare ~]# uname -a
Linux mrbtselfcare 2.6.9-42.ELsmp #1 SMP Sat Aug 12 09:39:11 CDT 2006 i686 i686 i386 GNU/Linux
You have new mail in /var/spool/mail/root
# 4  
Old 02-11-2009
Quote:
Originally Posted by Asteroid
So, should I write source and compile same source on both machines separately to obtain two distributions of executable.
Yep, that's the idea. Programs using POSIX features should compile on most any POSIX system.
Quote:
Or on the other hand write code in such a way if compiled on any of the machine(SUN) will work on the other (LINUX)
You won't be able to produce an executable that'll work on both.
# 5  
Old 02-11-2009
The first approach is the preferred one and I don't think you can compile a single executable to work on both Linux and Solaris machines. Differences in MPU instruction set, endianness etc. come into play during compilation so the object code produced on one platform would be incompatible on the other.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

From iOS programming to Linux system programming

Hello. I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations: 1. Linux and iOS are UNIX-like systems, POSIX compliant. 2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 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. Shell Programming and Scripting

Sh programming

I have started writing one script. It is not taking the if block. Here is the script: #!/bin/sh set USER='/usr/ucb/whoami' ####################################################################### #Killing Process #######################################################################... (6 Replies)
Discussion started by: amarpreetka
6 Replies

4. Programming

C Programming - Hardware Programming

Can someone help me on suggesting some ways to access the memory content in RAM directly from C/C++ source code. Please provide me any book name or any URL so that I can get an exhaustive knowledge over it. If possible please give me some tips on interacting with hardwares directly through... (3 Replies)
Discussion started by: nandumishra
3 Replies

5. 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

6. Shell Programming and Scripting

New To Programming

Hello all!! I am new to programming, and to this forum. :D I am having sort of a problem. Me and my coworker are working on a code, both of us are stumped on a few things. One is we have a whole log file, i have found how to extract by column, but not by row. I need to extract by both.:confused:... (7 Replies)
Discussion started by: xkayla06
7 Replies

7. Programming

C++ programming

Sorry to ask this question here... where can I find a C++ programming thread? Thanks guys! (7 Replies)
Discussion started by: nadiamihu
7 Replies

8. 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

9. 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

10. Programming

c programming on vi

i am new in linux environment .I have used vi editor of Unix to get a programe compiled through "gcc ".kindly give me the options to get a program compiled & executed written in c on vi editor. I want the command to compile a file and the command to get that compiled file executed with any... (2 Replies)
Discussion started by: Rajraius
2 Replies
Login or Register to Ask a Question