Search code examples
c++netbeansprojectdynamic-library

Netbeans / C++: Link 2 projects together (Executable / Dynamic Library)


I am creating 2 projects at the moment. The first one is an executable application. The second one is a Dynamic Library. Is there a way to link the Dynamic Library to the application in Netbeans so when I run the application I can load in the Dynamic Library. I know I could just copy the built files over, but that is a pain in the ass as I need to test if it's working every minute.

Does anyone know how to do this? I'm pretty sure it's possible as it would be so useful in many cases.


Solution

  • Yes it's possible:

    1. Application Project -> right click -> Properties -> Linker
    2. Libraries -> ... -> Add Project -> select your library project (-> check Build and select the Configuration if necessary)
    3. Add the proper include directory at C or C++ Compiler settings
    4. Properties -> Related Projects -> ... -> at your library project there

    Not sure if step #4 is required.

    If you build your application project, the library project will get build too.