I create new c/c++ project in Netbeans and change Makefile and add -lpthread for work with pthread and run my 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 ?
views:
504answers:
1It 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.