开发者

Netbeans re produce Makefile when change options in c/c++ developing

I create new c/c++ project in Netbeans and change Makefile and add -lpthread for work with pthread and run m开发者_运维百科y project .also I need to add some runtime argument from project properties/Run/Arguments . when I change runtime Arguments Makefiles that place at /'project folder'/nbproject/private/Makefile-Debug.mk & Makefile-Release.mk are re produced and my edit and -lpthread clear .

now it's a bug ? or feature ? and how to avoid it ?


It is not feature, :( Makefiles are generated automatically so any your changes will be lost every time Makefile change (eg when you add new files to project)

Solution is to use Netbean's Makefile Wizard!

project properties->Linker->Libraries->Add Standard Library->Posix Threads 
or
Add Option->Other Option-> -lpthread

And Netbean will take care about Makefiles itself.

EDIT (in response to first comment below): Alternative to Netbeans makefile wizards (and project properties) is to not use it! There are some good tools that have the same functionality as Netbeans Makefiles and all of them are based on Make.

Look for Ant or qmake. But in that approach you will have to write configs for your app yourself (but written once require changes only if new files are added to project) and second disadvantage is that every time you wont to compile and run your app you will have to type a command in console.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜