Solved

compile multi source program

Posted on 2004-10-05
2
204 Views
Last Modified: 2010-04-22
hello, all
      
  i am beginner of linux programming. I create a header file "A.h" save in "../inc", and the source file saved in in "../Cpp/B.cpp", which includes "A.h". How can i perform compilation by using g++?

thanx in advance.
kim
0
Comment
Question by:kim_wei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 12

Expert Comment

by:stefan73
ID: 12228163
Hi kim_wei,
Simply type

g++ -I ../inc ../Cpp/B.cpp -o B_binary

Cheers!

Stefan
0
 
LVL 12

Accepted Solution

by:
stefan73 earned 30 total points
ID: 12228185
-I sets the include path. You can combine multiple -I, like

g++ -Idir1 -Idir2 -Idir3 ... file1.cpp file2.cpp ... -o output_path_and_name

But don't write spaces between -I and the path, so your command line should be
g++ -I../inc ../Cpp/B.cpp -o B_binary
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question