![]() |
|
#1
|
|||
|
|||
Steps to create and compile c program in SUSEHi !
I am a newbie and have been working in windows XP and bloodshed dev-c++ compiler b4, but recently I have made the decision and managed to switch to linux. I started by using SUSE 9.1 personal linux on Vmware workstation. I apologize for my dumbness, but I have no clue to create and compile a c program in SUSE. Can anyone please give me a few steps on how to do that. I opened up something called root shell and wrote the following command " cpp pathname/filename.c" I got a message saying cannot find file stdio.h. I am tottally lost about this,can any please give me the right way to to write a program and compile it. There is also something called kwrite, notepad and vi. I have no idea which to use to create a program. Any help would be appreciated !!! |
|
#2
|
||||
|
||||
|
Hi batrsau and welcome to the wonderful world of Linux!
First of all, do not use a root shell. You should avoid doing things as root when possible. Most of the time it is not necessary to be root to compile a program. The command you want to use is gcc or g++ for a C++ program. cpp actually calls the pre-processor, which is automatically called by the compiler. The basic use of g++: CPP / C++ / C Code:
This will take a single file, compile it and link it into a binary file called myprogram. Hope this helps, d __________________
The best damn Sports Blog period. |
|
#3
|
|||
|
|||
|
Thanks for the reply Mod,
I tried the steps you told but I get some problems : error : stdio.h : no such file or directory found I downloaded this linux version from "www.linuxiso.org" and I am presuming it doesn't have the c compiler and library installed in it. Two questions : 1. Can you tell me what package to download from SUSE's website that will give me the library and compiler. 2. Since I am running this linux on Vmware I would also need some advice on how to install it on the SUSE through Vmware. Thanks again |
|
#4
|
||||
|
||||
|
Hi batrsau.
I believe that the compiler at least is installed if the command g++ actually started. It may be a pathing issue it sounds like because it can't find stdio.h. Here is a couple more suggestions:
If none of this works, then I will try to help you get the necessary files installed. Good luck! d __________________
The best damn Sports Blog period. |
|
#5
|
|||
|
|||
|
Thanks for the reply Mod.
Unfortunately, I didn't find the file stdio.h, I used the command you gave me as and the closest thing I found was in the folder /usr/share/man/man3/ and the files have a weired extension as stdio.3.gz, some other files were stdin.3.gz, stdout.3.gz and stpcpy.3.gz I downloaded this linux version from "http://www.linuxiso.org" its SUSE 9.1 personal-x86 and I am using Vmware Workstation 5.0 to run this linux. I don't if suse was bad idea, but I have tried a few before, I tried to install FC3 but I never get a clean media check for CD1 and CD3, the md5sums were fine and I have wasted quite a lot of Cd's on that, I have tried KNOPPIX and College Linux but the use and installtion and are a little weired, then I decided to go to SUSE and now this, I guess the next option would be to get mandrake if nothing works. The sad part is I have a pretty slow connection so it takes a while to get all this stuff. I haven't given up hope...... yet !!!!!! |
|
#6
|
|||
|
|||
|
Sorry for the double post !!!!
I ran yast2 on SUSE 9.1 and these are the packages I could find which puzzles me even more now : Package Summary Size Version cpp The GCC preprocessor 3.6MB 3.3.3-41 libgcc C compiler Runtime library 39.2kB 3.3.3-41 Does this mean I already have gcc installed but why can't I run it then ? |
|
#7
|
||||
|
||||
|
Hi batrsau.
It does seem strange that gcc would be there, but the include files are not. They should be installed anytime that gcc is installed. Can you tell me where your gcc is installed? It is most likely in /usr/bin or /usr/local/bin. Your header files should be included in a path like /usr/include or /usr/local/include respectivelly. You can install a new version of gcc if you would like. It is a rather large download file and will take at least an hour to build. You can find the current releases at this ftp site. If you are going to build brand new, you should probably go with either 3.4.3 or 4.0.0. The only reason to hold off on 4.0.0 is that it is the first release in that branch. I just installed 4.0.0 and have not had any problems though. If you want to install from scratch, let me know and I will give you abbreviated instructions. It is not difficult, but it does take some time. __________________
The best damn Sports Blog period. |
|
#8
|
|||
|
|||
Re: newbie: steps to create and compile c program in SUSETo get them there is an even easier way
sudo install get-apt build-basics OR sudo install get-apt build-basics As for the library try /usr/include |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 13:30 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The