Solved

compile multi source program

Posted on 2004-10-05
2
198 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

772 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