scanf函数:浮点格式没有联系 [英] scanf: floating point format not linked

查看:157
本文介绍了scanf函数:浮点格式没有联系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误scanf函数:浮点格式没有联系
 而读值'info'of以下结构。

I'm getting error scanf: floating point format not linked while reading value for 'info'of following structure.

struct node
{
    float info; struct node *next;
}*start;

在main()

void main()
{
       struct node *temp;
       temp = (struct node*)malloc(sizeof(struct node));
       printf("enter data = ");
       scanf("%f",&temp->info);
}

其不读为scanf函数的值,出来的方案。

its not reading any value for that scanf and coming out of program.

如何解决这个问题?

推荐答案

根据以下链接:
<一href=\"http://docs.embarcadero.com/products/rad_studio/radstudio2007/RS2007_helpupdates/HUpdate4/EN/html/devwin32/rte_printf_scanf_float_not_linked_xml.html\" rel=\"nofollow\">http://docs.embarcadero.com/products/rad_studio/radstudio2007/RS2007_helpupdates/HUpdate4/EN/html/devwin32/rte_printf_scanf_float_not_linked_xml.html

您可以添加以下code为一个源模块(和它的工作对我来说):

you can add following code to one source module (and it worked for me):

extern _floatconvert;
#pragma extref _floatconvert

例如:

#include<....>
.............

extern _floatconvert;
#pragma extref _floatconvert

int main(){......}
..........
..........


解决方案2:

添加下面的虚拟函数源$ C ​​$ C:


Solution 2:

Add the following dummy function in source code:

void dummy()
{
    float f,*fp;
    fp=&f;
}

这篇关于scanf函数:浮点格式没有联系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆