LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-18-2010, 02:17 PM   #1
leogg23
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
compiling .cpp files


Hello, I am trying to compile the .cpp files and .h files to be able to run a program called PALS. I have like 30 files in a directory (both .cpp and .h) and I do not know if I should just try to compile them all with g++ command. Would this give me an executable file right away?

thanks

Leo
 
Old 11-18-2010, 02:30 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
It is easy to try:
Code:
g++ *.cpp -o pals
If the errors/warnings don't look too bad, try running it with
Code:
./pals
I have no idea whether that simple method of building it will work. It depends on what is in your 30 files.

Last edited by johnsfine; 11-18-2010 at 02:32 PM.
 
Old 11-18-2010, 02:35 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by leogg23 View Post
Hello, I am trying to compile the .cpp files and .h files to be able to run a program called PALS. I have like 30 files in a directory (both .cpp and .h) and I do not know if I should just try to compile them all with g++ command. Would this give me an executable file right away?
Like johnsfine said, without knowing what the code is, it's hard to say what it'll do. Would help if you provided details, such as version/distro of Linux, and where you got the PALS software you're trying to compile. Does it have instructions with it? A Makefile?
 
Old 11-19-2010, 08:02 AM   #4
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
if you want one executable from all the 30 files, you should have a Makefile or you will have to write your own.
 
  


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
Issue in compiling cpp file partha82 Linux - Software 1 06-24-2010 05:04 PM
CPP Fails Sanity Check when compiling grapnell Linux - Software 4 08-16-2006 10:03 AM
error in compiling a simple cpp prog.. nick021 Programming 10 05-25-2006 04:30 PM
compiling .h and .cpp files with g++ arnab_be Linux - Newbie 2 03-03-2004 02:23 PM
/lip/cpp error when compiling mep]-[isto Linux - Newbie 1 12-22-2003 06:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:40 AM.

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