0

I just installed ubuntu via dual boot on my laptop and further installed vscode along with build-essenttial command. Everything is working fine in my current knowledge but in any code where #include<math.h> is used and inside main function pow() is used. Vs code is giving this error. I have tried every possible thing but can't resolve it.

image :

enter image description here

Parisa.H.R
  • 3,303
  • 3
  • 19
  • 38
Ayush
  • 1
  • 1
    Add `-lm` flag. I though it was added by default... – HolyBlackCat Feb 18 '22 at 06:55
  • Does this answer your question? [Undefined reference to pow( ) in C, despite including math.h](https://stackoverflow.com/questions/12824134/undefined-reference-to-pow-in-c-despite-including-math-h) – Brainless-Coder Feb 18 '22 at 06:57
  • You need to link your C file to `libm`, eg: `gcc main.c -lm -o main` – Darth-CodeX Feb 18 '22 at 07:02
  • For future questions please provide a [mre] and the full text of error messages as text not screenshots. Please also don't tag c++ for c questions and visa versa – Alan Birtles Feb 18 '22 at 07:04

0 Answers0