LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-28-2005, 10:30 PM   #1
EchO
Member
 
Registered: Jan 2002
Location: NY
Posts: 42

Rep: Reputation: 15
gcc header files and cpp files?


ive been looking and cant find any way to compile and link header files with its counterpart cpp file.

IE: i have Date.h used in Date.cpp, and cant seem to link them together, let alone compile them, how can i go about doing this?
 
Old 02-28-2005, 10:45 PM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Ok, first thing you should do, use g++ instead of gcc.

#include "Date.h" in your Date.cpp file.

g++ -Wall -o Date Date.cpp
 
Old 03-01-2005, 12:14 AM   #3
EchO
Member
 
Registered: Jan 2002
Location: NY
Posts: 42

Original Poster
Rep: Reputation: 15
ah you rock, totally worked, thanks alot
 
Old 03-01-2005, 02:14 AM   #4
EchO
Member
 
Registered: Jan 2002
Location: NY
Posts: 42

Original Poster
Rep: Reputation: 15
one more question i hope to get answered, what flag(s) other than -Wall and -o do i need if the cpp file in question doesnt have a main? when using -Wall and -o i got errors about main, threw one in there and it worked like a charm, but what if i dont want to use main? the program originally didnt have one, and since it was given to me by a professor i know it works and what not. any clues to have it not complain about a missing main() ?

THANKS I REALLY APPERICATE IT !!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Including header files and source files for classes Feenix Programming 8 09-28-2005 11:53 AM
c header files in linux in place of header files in windows? harun_acs Programming 1 03-17-2004 03:24 AM
compiling .h and .cpp files with g++ arnab_be Linux - Newbie 2 03-03-2004 03:23 PM
gcc won't recognise local header files surio Linux - Software 0 09-10-2003 06:02 PM
Problems when trying to compile cpp files using qt headers siphiuel Linux - Software 2 08-10-2003 08:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:14 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration