Solved

compile multi source program

Posted on 2004-10-05
2
195 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
Comment Utility
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
Comment Utility
-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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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 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…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now