LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-10-2009, 08:04 AM   #1
Asteroid
LQ Newbie
 
Registered: May 2007
Posts: 27

Rep: Reputation: 15
Programming using 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
 
Old 02-10-2009, 08:15 AM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by Asteroid View Post
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)
Sun provides a compiler that you can use, but be prepared to spend money on it. If you want something free, then use GCC.

Quote:
Originally Posted by Asteroid View Post
2. From where I can get that compiler and how to install the compiler
GCC is available at http://www.gnu.org, or more specifically at http://directory.fsf.org/project/gcc/. Contact Sun if you wish to use their compiler.

Quote:
Originally Posted by Asteroid View Post
3. From where I can get C/C++ libraries for Solaris/UNIX?
These are included with the compiler. Other libraries with the OS.

Quote:
Originally Posted by Asteroid View Post
4. How to start compiling and running program?
1) Edit your program; save to a .c (or .cpp) file
2) gcc file.c -o file
3) ./file

For C++ files, use 'g++' in lieu of 'gcc'.

Quote:
Originally Posted by Asteroid View Post
5. Will those programs written portable on both LINUX/SOLARIS?
Only you can assure this. Make sure that you stick with the standards and POSIX compliant libraries. Using the following GCC flags is helpful too: -ansi -pedantic

Last edited by dwhitney67; 02-10-2009 at 08:17 AM.
 
Old 02-10-2009, 11:30 AM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Rather, use

gcc -Wall file.c -o file
.

You'll see warning with -Wall if compiler thinks your program is not quite correct, and it's a good thing.

I think Sun distributes precompiled gcc for their OSes.

I can help you build gcc from scratch using a tool I developed, and you don't have to be 'root' in order to build and install it.
 
Old 02-11-2009, 03:41 AM   #4
Asteroid
LQ Newbie
 
Registered: May 2007
Posts: 27

Original Poster
Rep: Reputation: 15
@Sergei Steshenko & @dwhitney67

Thx for the help.

@Sergei Steshenko

Quote:
I can help you build gcc from scratch using a tool I developed, and you don't have to be 'root' in order to build and install it.
Appreciating a lot, the way you are assisting. please let me know how can I use the above tool mentioned by you.
Thank you.
 
Old 02-11-2009, 04:08 AM   #5
Asteroid
LQ Newbie
 
Registered: May 2007
Posts: 27

Original Poster
Rep: Reputation: 15
Some further developments. I came to know I have GCC on both LINUX and SUN.

So, Am I ready to start writing code? and distributing executables to any of the machines LINUX/SUN for execution. Should I compile SUN distribution on SUN machine and LINUX distribution on LINUX machine.

Need you suggestions....

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
 
Old 02-11-2009, 05:20 AM   #6
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Those are older versions of GCC. Many Linux systems today ship with version 4.2.x or 4.3.x.

Which distro of Linux are you using? Can it be upgraded?
 
Old 02-11-2009, 06:19 AM   #7
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
Should I compile SUN distribution on SUN machine and LINUX distribution on LINUX machine.
Yes, you should do that.
 
Old 02-11-2009, 06:26 AM   #8
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Asteroid View Post
@Sergei Steshenko & @dwhitney67

Thx for the help.

@Sergei Steshenko



Appreciating a lot, the way you are assisting. please let me know how can I use the above tool mentioned by you.
Thank you.
Well, the tool is FOSS, but the officially released version is quite old. I guess you can contact me through PM and give some Email of yours.

I'll send you the tarball and instructions - basically, just a single (though long) command line. The tool is supposed to do everything automatically, beginning from downloading sources from the net.

If you have problems, contact me back, I'll try to help you.

In 2006 the tool was capable of building gtk+ and all its dependencies on Solaris.

The tool is my workhorse, i.e. I'm building the needed for me infrastructure using it.

My "egoistic" interest is to try the tool on Solaris again - I do not have access to Solaris, especially, I do not have access to SPARC Solaris.

If you want to get the idea, the outdated version is here: http://AppsFromScratch.berlios.de/ .

FWIW, my present version builds both gcc-3.4.6 (needed for QEMU) and gcc-4.3.3 - for the rest. Both versions coexist peacefully.
 
Old 02-11-2009, 07:26 AM   #9
Asteroid
LQ Newbie
 
Registered: May 2007
Posts: 27

Original Poster
Rep: Reputation: 15
No , we cannot upgarde.
Will this GCC version will not bring out most of my programs, any problems expected to be faced due to this version?
 
Old 02-11-2009, 08:17 AM   #10
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Asteroid View Post
No , we cannot upgarde.
Will this GCC version will not bring out most of my programs, any problems expected to be faced due to this version?
On the one hand, gcc-3.4.6 is a good compiler.

On the other, later gcc versions, especially the gcc-4.3.* thread, are much stricter WRT to language.

So, if you use gcc-3.4.6 to develop your programs, they might fail to work if compiled with a later gcc version.

The beauty of the offered AppsFromScratch is that you change _nothing_ at system level, and you do not even need root permissions to build and install the stuff.

I.e. you can build your own up to date programming "universe" without breaking the existing system and without having any conflict with it.
 
Old 02-11-2009, 08:26 AM   #11
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Asteroid View Post
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
what type of programs are you trying to code up?
 
Old 02-12-2009, 06:50 AM   #12
Asteroid
LQ Newbie
 
Registered: May 2007
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
what type of programs are you trying to code up?
Some sort of Network monitoring system, Monitor SUN Machines health and applications running on them.

Let me share with you, I am willing to write code for machines which are part of LIVE communication NETWORK (TELCO).

Any suggestions... for the stat up

Regards
@Asteroid
 
Old 02-12-2009, 09:24 AM   #13
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
there are already solaris tools that are able to do network monitoring, checking system health etc. i don't see why you need to write your own.
 
Old 02-12-2009, 06:12 PM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,364

Rep: Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752Reputation: 2752
looked at Nagios?
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New MSN group: programming fans -- enjoy programming lswhbcb Programming 1 06-29-2007 07:21 AM
Difference between Top Down programming & Bottom up programming minil Programming 1 06-17-2005 02:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration