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
kim_weiAsked:
Who is Participating?
 
cjjcliffordConnect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.