When compiling GCC in Ubuntu, math. H library is not specified by default, and GCC undefined reference to sqrt appears
When this error occurs, you need to specify which library to connect to at compile time
gcc xx.c -lm -o xx.out
-L is the specified XX library, M is the math library
Similar Posts:
- Undefined reference to ‘pthread’ appears in Linux Ubuntu running thread program_ Create ‘and undefined reference to’ pthread ‘_ ‘join’ error.
- Hi3516DV300 Chip Error: “undefined reference to ×”
- undefined symbol: xxx – undefined reference to `typeinfo
- [Solved] undefined reference to `cv::imread(std::string const&, int)’
- [Solved] Undefined reference_G++ _GLIBCXX_USE_CXX11_ ABI compilation error: STD:: Basic_String and STD::__cxx11::basic_String cannot match
- Using SQLite to show undefined reference to ` SQLite3_ open’…
- How to Solve Error: undefined reference to ‘func’
- Solve the error reported by vscode referring to C + + external library
- The source code installs the git tool, which shows /usr/local/lib64/libcrypto.a(dso_dlfcn.o) undefined reference to `dlopen’
- [MERFISH Error] Error2 ld/ symbol(s) not found for architecture x86_64