ubuntu 中How to fix undefined reference to `sqrt' in Eclipse
来源:互联网 发布:python 功能测试 编辑:程序博客网 时间:2024/06/04 19:53
Friday, September 23, 2011
How to fix undefined reference to `sqrt' in Eclipse
Re: How to use math.h in Eclipse with gcc? [message #214058 is a reply to message #213974]Wed, 16 April 2008 04:50 Tracy Miranda
Messages: 15
Registered: July 2009 Hi Warren,
The "-lm" option is a linker option - looks like you've added it to the
Compiler 'Other flags', where it has no effect.
Add it to the linker options, Libraries-> add it in as a new library "m",
this will automatically add on the -l to the option.
(Alternately, you can add "-lm" to the Miscellaneous->Linker Flags box, but
I highly recommend the previous option).
Tracy
"Warren Tang" <warren.c.tang@gmail.com> wrote in message
news:fu2ftr$bai$1@build.eclipse.org...
>
> I tried to add the "-lm" option for gcc in the project properties:
> -c -fmessage-length=0 -std=c99 -lm
>
> However the eclipse still complains that:
> undefined reference to `sqrt'
>
Messages: 15
Registered: July 2009 Hi Warren,
The "-lm" option is a linker option - looks like you've added it to the
Compiler 'Other flags', where it has no effect.
Add it to the linker options, Libraries-> add it in as a new library "m",
this will automatically add on the -l to the option.
(Alternately, you can add "-lm" to the Miscellaneous->Linker Flags box, but
I highly recommend the previous option).
Tracy
"Warren Tang" <warren.c.tang@gmail.com> wrote in message
news:fu2ftr$bai$1@build.eclipse.org...
>
> I tried to add the "-lm" option for gcc in the project properties:
> -c -fmessage-length=0 -std=c99 -lm
>
> However the eclipse still complains that:
> undefined reference to `sqrt'
>
Math.h problem
Programming in C using Eclipse in Linux is great, however when i added variables that were doubles into the "sqrt" function from the "math.h" library there was a problem that came up.
Programming in C using Eclipse in Linux is great, however when i added variables that were doubles into the "sqrt" function from the "math.h" library there was a problem that came up.
undefined reference to `sqrt'After a little bit of research, in Eclipse, go to Project > Properties > C/C++ Build > Settings > GCC C Linker > Miscellaneous > add "-lm" to the "Linker Flags" text field. That way it is properly linked to the project.
http://cboard.cprogramming.com/c-programming/88943-undefined-reference-sqrt.html
0 0
- ubuntu 中How to fix undefined reference to `sqrt' in Eclipse
- undefined reference to `sqrt'
- eclipse c undefined reference to `sqrt'
- eclipse c undefined reference to `sqrt'
- undefined reference to `sqrt' 问题
- undefined reference to `sqrt' 问题
- undefined reference to `sqrt'问题
- undefined reference to `sqrt' 问题
- undefined reference to `sqrt' 问题
- How to fix Fatal error: Call to undefined function: mysql_connect() in Ubuntu
- How to fix Failed to load JavaHL Library in Eclipse
- undefined reference to `sqrt' 的解决办法
- C 语言 undefined reference to 'sqrt' 问题解决
- gcc 编译错误:"undefined reference to 'sqrt'
- C 语言 undefined reference to 'sqrt' 问题解决
- error fix undefined reference to libiconv_open'
- How to fix GC overhead limit exceeded in Eclipse
- How to fix GC overhead limit exceeded in Eclipse
- C#对Excel操作
- 滕王阁序
- C# 判断两张图片是否一致,极快速。
- Java修改文件名
- android怎么获取一个SD卡指定文件夹的图片Uri uri有关问题
- ubuntu 中How to fix undefined reference to `sqrt' in Eclipse
- python IDE比较与推荐
- PHP非常实用的9段代码
- 常用 Web Service
- UVa 331 - Mapping the Swaps
- Android-屏蔽掉Layout里面子元素,由Layout来响应点击事件
- js 日历控件日期多选 kalendae.js
- 递归问题:二汉诺塔
- 一个故事