LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-11-2004, 09:31 PM   #1
gdkyle
LQ Newbie
 
Registered: Aug 2004
Posts: 2

Rep: Reputation: 0
Unhappy how to compile c++ program in red hat 9


I am just a freshman to linux.I want to know how to compile c++program in red hat 9, I tried to use gcc, but it return many things that i don't know. my program just a hello world program and using stl. another question is :I execute a makefile, but the system tell me that i don't have the right, but I login the system by root account, why?
 
Old 08-11-2004, 09:57 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Try with command g++
makefiles are run -- in a sense -- by issuing a command "make"
 
Old 08-11-2004, 10:05 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Use the g++ command. I don't see why you would have a problem running make, unless one of the commands in your makefile isn't set up right or your PATH variable needs something added.

You really shouldn't be root. If you are installing a program from a tarball, then the 'make install' step needs to be done as root. The rest of the time it is safer to work under your regular account.

Where are you trying to compile the program. If it is in a subdirectory in your home directory, you shouldn't have a problem, but some partitions may be mounted with the noexec option for security reasons.
 
Old 08-12-2004, 12:38 AM   #4
cppkid
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Ubuntu
Posts: 185

Rep: Reputation: 30
To compile the program go to Terminal console and use command.

g++ -c myfile.cpp

this will generate myfile.o and you have to link it using

g++ -o myfile myfile.o

Now you have "myfile" that is executable, but to execute you have to change its modes use.

chmod +x myfile

Now run your program from the same directory by typing

./myfile

Only myfile will not work, Use " ./myfile ".

I don't know what can be wrong with your make, You better give the script of your make file and tell, What command are you using for make.
 
  


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
Compile 2.4.22 kernel - Red Hat Fedora - fs webamoeba Linux - Newbie 2 03-18-2004 11:15 AM
Is there a defrag program with in Red Hat? Da_Quest Linux - Networking 2 08-26-2003 09:37 PM
kernel, compile, gcc, red hat 8.0 illtbagu Linux - Software 9 03-24-2003 01:12 PM
How to install a program on Linux Red Hat Epox Linux - Software 6 07-20-2002 03:12 PM
Red Hat 7.2 Kernel Compile Help sfeek Linux - Distributions 1 05-21-2002 09:39 AM

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

All times are GMT -5. The time now is 05:50 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