I create projects using C99 in NetBeans. But when I try to include the library math.h, sqrt() and cbrt() won't work. I am on Ubuntu and using Apache NetBeans IDE 11.2. It is updated to NetBeans 8.2 Patch 2.
The steps I do are : File > New Project > C/C++ > C/C++ Application > Finish. The option Create Main File is checked and it is in C99. I then add #include at the beggining of my code, and at each line I use sqrt() I get an error code : Unable to resolve identifier sqrt.
My code is the following :
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char** argv) {
double x = 1.5;
double z;
z = sqrt(x);
return (EXIT_SUCCESS);
}
And I get an error at line 9.
The reason why I want to edit default project properties is because when I add -lm to my project properties, the error remains but at least to project can run. If it is not in project properties, the project will not run.