sqrt函数找不到标识符
时间: 2023-10-18 09:26:33 浏览: 292
函数_函数_C++_
当使用gcc编译时,如果在代码中使用了sqrt函数但是没有加上-lm参数,编译器会报错说找不到sqrt函数的标识符。这是因为sqrt函数属于math库,需要在编译时加上-lm参数来链接math库,使得编译器能够找到sqrt函数的定义。类似地,当编写使用了posix thread的程序时,也需要在编译时加上-lpthread参数来链接pthread库。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Linux下用C编程 sqrt函数找不到,已解决](https://blog.csdn.net/aaevilive/article/details/79046485)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [c++的sort函数 使用出现错误,无法排序??](https://blog.csdn.net/weixin_31947509/article/details/117214334)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文