Including source files from another C++ project in Eclipse CDT

前端 未结 4 1299
离开以前
离开以前 2021-02-04 06:57

I have a C++ project in Eclipse CDT which uses some functions from OpevCV and it compiles into an executable and works fine. Now I want to have a new C++ project which uses some

4条回答
  •  温柔的废话
    2021-02-04 07:39

    I was looking for an answer too but the previous answers did not solve the problem. (Nick's answer was helpful). You have to define 2 things:

    1. Go to Project->Properties->C/C++ general->Paths and Symbols. Select the Source Location tab and click the Link Folder..., Then select the folder you want to include.
    2. Go to Project->Properties->C/C++ general->Paths and Symbols. Select the Includes tab. Make sure you select the correct language on the left menu (for example: GNU C++) and click Add..., Then select the folder you want to include.

    Note: I'm not sure it's necessary but when I created the external project I selected the "Shared Library" option in the new project wizard.

    To make sure you did everything OK, go to : Project->Properties->C/C++ Build->Settings. Select the GCC C++ Linker and make sure that the All options contains "-L/your_folder_name". Repeat this for GCC C++ Compiler also.

提交回复
热议问题