• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

compile multi source program

hello, all,

 i am a quite new linux programmer, i coded one header file "A.h", two source files "B.cpp", "C.cpp".
 I needs to know how to compile and link them to an exe.

Thanx in advance

kim
0
kim_wei
Asked:
kim_wei
  • 2
1 Solution
 
cjjcliffordCommented:
g++ B.cpp C.cpp -o test.exe

This assumes you have "g++" installed, and in your path, and that the A.h is in the current directory.
0
 
kim_weiAuthor Commented:
hello, cjjclifford,
      
  thanx a lot, if the header file in other directories, how can the header file be complied with other source files?

kim
0
 
cjjcliffordCommented:
the -I flag can be used to specify which directories, or if they are in subdirectories, you can change the #include line to include the (sub)directory path...

Cheers,
C.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now