Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined reference to `round' c language

I'm using those imports

#include <stdio.h>
#include <math.h>

and I'm getting undefined reference to `round' at this line:

double res = round(atof(nextVal));

nextVal is a double value read from a file.

I'm using Eclipse INDIGO.

like image 820
Itzik984 Avatar asked Dec 07 '22 19:12

Itzik984


1 Answers

In command line, you must specify -lm option to gcc to link the math lib. You have to find how to do so in eclipse.

like image 72
Aif Avatar answered Dec 09 '22 09:12

Aif