简体   繁体   English

如何在netbeans中创建项目依赖项(c / c ++插件)

[英]How to create project dependencies in netbeans (c/c++ plugin)

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. 当我在c ++应用程序上工作时,我意识到我正在创建许多可以在其他项目中使用的类和函数。 So I'd like to put all this code in a separate net beans project that can be "included" into other projects. 所以我想将所有这些代码放在一个可以“包含”到其他项目中的单独的net beans项目中。 (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. 我已经尝试创建一个新的“静态库”项目,然后我将项目添加到我的主项目(通过首选项 - >链接 - >库并添加我的“库项目”),但代码完成功能找不到当我尝试#include它时,我的库项目的.h文件,该项目也将无法构建。

What is the correct way to do this? 这样做的正确方法是什么?

Creating a static library and adding it to Linker->Libraries is correct. 创建静态库并将其添加到Linker-> Libraries是正确的。 But another small step is needed: add directory with shared *.h files to project properties -> C Compiler (or C++ Compiler) -> Include Directories. 但是需要另一个小步骤:​​将带有共享* .h文件的目录添加到项目属性 - > C编译器(或C ++编译器) - >包含目录。

Also take a look at Subprojects sample: File -> New Project -> Samples -> C/C++ -> Subproject Application. 另请参阅Subprojects示例:文件 - >新建项目 - >样本 - > C / C ++ - >子项目应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM