views:

921

answers:

1

As I work on a c++ application, I realize I am making a lot of classes and functions that could be used in other projects. So I'd like to put all this code in a separate net beans project that can be "included" into other projects. (with code completion etc)

I've tried creating a new "static library" project, then I added the project to my main project (by going to preferences->link->libraries and adding my "library project"), but the code completion feature does not find the .h file of my library project when i try to #include it, the project also won't build.

What is the correct way to do this?

+4  A: 

Creating a static library and adding it to Linker->Libraries is correct. But another small step is needed: add directory with shared *.h files to project properties -> C Compiler (or C++ Compiler) -> Include Directories.

Also take a look at Subprojects sample: File -> New Project -> Samples -> C/C++ -> Subproject Application.

Alexey
+1 for pointing out Subprojects sample.
ShaChris23