Author Topic: How to configure project with multiple c/c++ setting  (Read 2415 times)

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
How to configure project with multiple c/c++ setting
« on: April 09, 2017, 05:50:42 AM »
Hi Expert,
    I have below project/directory  with multiple sub directory for source code and corresponding make file

my_code 
     | --- package_1
            |--- a.c
            |--- b.c
            |--- a.h
            |--  Makefile
     | -- package_2
            | -- x.c
            | -- y.c
            | -- Makefile
      | -- include


     package_1 will copy a.h to include directory,  package_2/x.c will refer to a.h
     
     and also for package_1, I have option for compiler , g++ -D PACKAGE=1
     for package_2, I have g++ -D PACKAGE=2

     my question is how to create a project/workspace for it? (especially how to configure the -D option for projects?)

Thanks
Lusu
« Last Edit: April 09, 2017, 05:59:55 AM by lusu2004 »

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: How to configure project with multiple c/c++ setting
« Reply #1 on: April 11, 2017, 07:33:17 PM »
I would do one workspace with two projects.

For project_1:  Project > New... > C/C++ > GNU C/C++ ..., Check (x) Create new workspace
For project_2:  Project > New... > C/C++ > GNU C/C++ ..., Check (x) Add to current workspace

Project > Project Properties... > Compile/Link to define symbols in each package.

For project_2:  Project > Project Properties... > Dependencies... make it depend on project_1

Include a.h from the package_1 directory in the set of files, since the one in the Include directory is just a mirror copy, you don't want to be editing that (even if that is the *actual* file that package_2 uses).