简体   繁体   English

如何创建多个二进制C ++ netbeans项目?

[英]How to create multiple binary C++ netbeans project?

In my C++ linux project I wanna create daemon executable that forks and executes actual executable. 在我的C ++ linux项目中,我想创建后台程序可执行文件,该程序分叉并执行实际的可执行文件。 I couldn't find a facility in netbeans IDE to create multiple main files that compile into corresponding executables. 我在netbeans IDE中找不到创建可编译为相应可执行文件的多个主文件的功能。 Need help in doing it in Netbeans IDE. 在Netbeans IDE中需要帮助。

Netbeans uses generated makefiles, those don't allow multiple main() -functions. Netbeans使用生成的makefile,这些makefile不允许使用多个main()函数。 As a solution you can write your own makefile. 作为解决方案,您可以编写自己的makefile。

However, you can use CMake with NetBeans instead (personal recommendation). 但是,您可以将CMake与NetBeans结合使用(个人推荐)。 CMake allows you to compile several executable / libraries in one run. CMake允许您一次运行编译多个可执行文件/库。

Some advantages (respective to your problem): 一些优点(与您的问题有关):

  • Managing and compilation of multiple projects - each separated or all together 管理和编译多个项目-每个单独或一起
  • Not limited to Netbeans - CMake can generate project- or makefiles for various IDE's, even commanline-building is possible 不限于Netbeans-CMake可以为各种IDE生成项目或makefile,甚至可以构建命令行
  • Clean separation of actual code and build stuff 干净地分离实际代码并构建内容

NetBeans supports CMake, so it will build as usual; NetBeans支持CMake,因此将照常进行构建。 you just have to write a CMakeLists.txt (~ a makefile) by your own - but thanks to good documentation this wont be a huge problem. 您只需要自己编写一个CMakeLists.txt (〜一个makefile)-但是由于有了好的文档,这将不是一个大问题。

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

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