c语言被提示 undefined reference to
#include<stdio.h>#include<string.h>floatin(float,float);intmain(void){floata,b,v;prin...
#include <stdio.h>
#include <string.h>
float in(float,float);
int main(void)
{
float a,b,v;
printf("enter two number,q to quit");
while(scanf("%f %f",&a,&b)==2)
{
printf("it is %f\n",in(a,b));
}
float in(float c,float d)
{
float SUM;
for(c;c<d;c++)
{
SUM+=c;
c++;
return(SUM);
}
}
}
请问这是什么问题啊?提示in函数无效,是不是语法哪里出了问题,麻烦请帮忙看一下,蟹蟹O(∩_∩)O 展开
#include <string.h>
float in(float,float);
int main(void)
{
float a,b,v;
printf("enter two number,q to quit");
while(scanf("%f %f",&a,&b)==2)
{
printf("it is %f\n",in(a,b));
}
float in(float c,float d)
{
float SUM;
for(c;c<d;c++)
{
SUM+=c;
c++;
return(SUM);
}
}
}
请问这是什么问题啊?提示in函数无效,是不是语法哪里出了问题,麻烦请帮忙看一下,蟹蟹O(∩_∩)O 展开
2个回答
2016-07-15
展开全部
假设你已经正确编译和安装了Sqlite,写个测试程序来测试:#include#include#include"sqlite3.h"intmain(void){sqlite3*db=NULL;char*zErrMsg=0;intrc;rc=sqlite3_open("test1.db",&db);if(rc){fprintf(stderr,"Can'topendatabase:%s\n",sqlite3_errmsg(db));sqlite3_close(db);exit(1);}elseprintf("openmydatasuccessfully!\n");sqlite3_close(db);return0;}用GCC来编译的时候总是会出现错误,编译的命令如下gcc-static-ohello-lsqlite3-L/usr/local/lib-I/usr/local/includehello.c错误信息如下/tmp/ccKeKpX9.o(.text+0x37):Infunction`main'::undefinedreferenceto`sqlite3_open'/tmp/ccKeKpX9.o(.text+0x51):Infunction`main'::undefinedreferenceto`sqlite3_errmsg'/tmp/ccKeKpX9.o(.text+0x73):Infunction`main'::undefinedreferenceto`sqlite3_close'/tmp/ccKeKpX9.o(.text+0x9b):Infunction`main'::undefinedreferenceto`sqlite3_close'collect2:ldreturned1exitstatus那么,恭喜你中招了。错误根本不在SQLITE也不在你的程序,而在GCC。Gcc的编译参数是有顺序的。正确的编译命令是:gcc-ohello-L/usr/local/lib-I/usr/local/include-statichello.c-lsqlite3
展开全部
你这是什么结构,为什么在main函数里定义float in(float c,float d)函数
#include <stdio.h>
#include <string.h>
float in(float,float);
int main(void)
{
float a,b,v;
printf("enter two number,q to quit");
while(scanf("%f %f",&a,&b)==2)
{
printf("it is %f\n",in(a,b));
}
return 0;
}
float in(float c,float d)
{
float SUM;
for(c;c<d;c++)
{
SUM+=c;
c++;
}
return(SUM);
}
#include <stdio.h>
#include <string.h>
float in(float,float);
int main(void)
{
float a,b,v;
printf("enter two number,q to quit");
while(scanf("%f %f",&a,&b)==2)
{
printf("it is %f\n",in(a,b));
}
return 0;
}
float in(float c,float d)
{
float SUM;
for(c;c<d;c++)
{
SUM+=c;
c++;
}
return(SUM);
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询