NDK开发的时候遇到error: undefined reference to 错误 [问题点数:20分,结帖人anbo724]

Bbs1
本版专家分:0
结帖率 45.45%
Bbs1
本版专家分:35
Bbs1
本版专家分:20
NDK编译出现undefined reference to错误
本文转载自:http://blog.chinaunix.net/uid-20680966-id-4961553.html最近在使用android studio编译安卓程序,要用到jni 我在jni源码中引用了__android_log_print ,且在Android.mk中加了LOCAL_LDLIBS := -llog 但是编译时还是会出现如下<em>错误</em>: Error:(82) <em>undefined</em>
解决使用NDK进行编译时出现undefined reference to function的问题
之前在编译jni时出现了<em>undefined</em> <em>reference</em> to function这个问题,查阅相关资料说是可能链接的库问题,然后通过各种gcc调整顺序解决了这个问题。这个工程是导师的工程,工程在Linux环境下运行无误,我从Linux环境往Android jni的一个迁移,由于文件的关联比较多代码量异常庞大和复杂(尝试着把方法直接复制到目标cpp中无果),而且我对gcc编译顺序这方面不是特别熟
NDK undefined reference to `main'
调试NDK中自带的HelloJni例子,编译的<em>时候</em>出现<em>undefined</em> <em>reference</em> to `main'的<em>error</em>,倘若我在.c中加入main函数,那是不是Android工程中就有两个程序入口点了?查了一下,“Add -shared to LD_FLAGS fixed it”,但不太明白,有大神帮个忙吗?帮我看看哪里的设置出现了问题?谢谢啊
error: undefined reference to 'wcstombs'
rnE:/android-<em>ndk</em>-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: jni/libfudx.a(FileBase.o): in function CUdxWchar::CpyFrom(wchar_t*):E:/FUdx_Android//jni/../jni/FastUdx/build/android/../../FileBase.h:88: <em>error</em>: <em>undefined</em> <em>reference</em> to 'wcstombs'rnrnrn用的别人的.a 文件 我这里根本没有FileBase.h。rnrn怎么处理啊..??
为什么会遇到:undefined reference to ... 的错误
一个多线程的程序,源代码大致如下:rn#include rn...rnrnint main(void)rn...rnpthread_create(&th1,NULL,(void *)task,(void *)&arg);rn...rnrnrn编译时总是出现<em>undefined</em> <em>reference</em> to 'pthread_create'rn的<em>错误</em>。我检查了pthread.h,里面的确定义了这个函数,这是为什么呢,rn怎样做才能改正这个<em>错误</em>?rnrn谢谢!
undefined reference to错误
下面的代码gcc的<em>时候</em>提示下面的<em>错误</em>,看半天没找出哪有毛病,请教高手指点!rn/tmp/ccmKb9yz.o: In function `sort':rntest.c:(.text+0x1f5): <em>undefined</em> <em>reference</em> to `merge'rncollect2: ld 返回 1rnrn[code=C/C++]rn#include rnrn#define MAXSIZE 8rnint arr[MAXSIZE] = 5, 7, 2, 1, 9, 4, 3, 8 ;rnrnvoid merger(int start, int mid, int end) rn int len1 = mid - start + 1;rn int len2 = end - mid;rn int left[len1];rn int right[len2];rn int i, j, k;rn // 相邻子序列赋值rn for (i = 0; i < len1; i++)rn left[i] = arr[start + i];rn for (j = 0; j < len2; j++)rn right[j] = arr[mid + 1 + j];rn // 合并相邻两个有序子序列rn i = j = 0;rn k = start;rn while (i < len1 && j < len2)rn if (left[i] < right[j])rn arr[k++] = left[i++];rn elsern arr[k++] = right[j++];rn // 检查是否合并完毕rn while (i < len1)rn arr[k++] = left[i++];rn while (j < len2)rn arr[k++] = right[j++];rnrnrnvoid sort(int start, int end) rn int mid;rn if (start < end) rn mid = (start + end) / 2;rn sort(start, mid);rn sort(mid + 1, end);rn merge(start, mid, end);rn rnrnrnint main(int argc, char**argv) rn sort(0, MAXSIZE - 1);rn int index = 0;rn for (index = 0; index < MAXSIZE; index++)rn printf("%d ", arr[index]);rn return 0;rnrnrnrn[/code]
Linux下undefined reference to错误
各位:我在写一个双向链表程序。里面有一个FindElebyIndex 函数,是用来查找链表中指定序号元素的,但是我在编译连接时提示如下<em>错误</em>:rn/tmp/ccSh2r0h.o: In function `main':rnDoubleLinkList.c:(.text+0x2ee): <em>undefined</em> <em>reference</em> to `FindEleByIndex'rncollect2: ld returned 1 exit statusrnrn我使用的命令是rngcc DoubleLinkList.c -o DoubleLinkListrnrn然而我把这个函数注释后重新编译通过,然后取消注释,编译也通过,并且运行结果正确。可是不知这里面发生了什么。请有过类似经验的大牛告诉我为什么会这样。为什么注释后编译链接,再取消注释重新编译链接就好了呢?rn我在网上搜这个<em>错误</em>,说是链接<em>错误</em>,但不知道错在了那里。rnrn这是我的源代码:rn//2011/05/08rn//DoubleList的实现和基本操作。包括查找,删除,增加等。rnrn#includern#includernrn#define True 1rn#define False 0rn#define null NULLrnrntypedef struct DNodernrn int data;rn struct DNode* prior; //前驱结点rn struct DNode* next; //后继结点rnDLinkList;rnrn//void PrintDl(DLinkList* dl);rnrn//头插法建表rnint CreateDoubleLinkList_head(DLinkList *dl,int n)rnrn DLinkList* s;int i;rn dl->next=null;rn dl->prior=null;rn for(i=0;idata));rn s->next=dl->next; //s的前驱指向下一个结点rn s->prior=dl; //s插入头结点之后 rn dl->next=s; //dl指向刚插入的结点 rn if(s->next!=null)rn rn s->next->prior=s; //若插入结点的下一个结点不为空,则后继结点的前驱指针域指向srn rn //printf("%d\n",dl->data);rn rn // PrintDl(dl);rn return True;rnrnrn//尾插法rnint CreateDoubleLinkList_tail(DLinkList *dl,int n)rnrn DLinkList *s,*r;rn int i=0;rn dl->next=null;rn dl->prior=null;rn r=dl;rn for(i=0;idata));rn r->next=s; //插入尾结点之后rn s->prior=r; //修改s的前驱指针域rn r=s;rn rn r->next=null; //尾结点next域设为空rn return True;rnrnrn//这里貌似出了一个链接<em>错误</em>:rn///tmp/ccSh2r0h.o: In function `main':rn//DoubleLinkList.c:(.text+0x2ee): <em>undefined</em> <em>reference</em> to `FindEleByIndex'rn//collect2: ld returned 1 exit statusrn//不知是何原因,重新注释这个函数后就正确了。rn//按序号查找第n个元素rnint FindElebyIndex(DLinkList* dl,int index,int *element)rnrnrn int i=0;rn DLinkList* s=dl;rnrn while(s!=null&&inext;rn rnrn if(s==null)rn rn return False;rn rnrn *element=s->data;rnrn return True;rnrnrn//Print DLrnvoid PrintDl(DLinkList* dl)rnrn DLinkList* s=dl->next;rn while(s!=null)rn rn printf("%d\n",s->data);rn s=s->next;rn rnrnrn//Testrnint main()rnrn //头插法建表rn DLinkList* dl =(DLinkList*)malloc(sizeof(DLinkList)); //建立带头结点的双向链表rn printf("输入你想要建表的结点个数:\n");rn int num=0;rn scanf("%d",&num);rn printf("输入这%d数:\n",num);rn CreateDoubleLinkList_head(dl,num);//头插法建表rn printf("链表中有的元素为:\n");rn PrintDl(dl);rn printf("====================================================\n");rn //尾插法建表rn DLinkList* doublelist=(DLinkList*)malloc(sizeof(DLinkList)); //建立带头结点的双向链表rn printf("输入你想要建表的结点个数:\n");rn int count=0;rn scanf("%d",&count);rn printf("输入这%d数:\n",count);rn CreateDoubleLinkList_tail(doublelist,count);//头插法建表rn printf("链表中有的元素为:\n");rn PrintDl(doublelist);rn //查找第n个元素并打印rn int n;rn printf("输入你想找的元素序号:");rn scanf("%d",&n);rn int x=0;rn int *e=&x;rn FindElebyIndex(doublelist,n,e);rn printf("您想找的元素为:%d\n",*e);rnrn return 0;rnrnrn
android ndk error :undefined reference to.
在用AS的NDK编译c时,添加了一个C的头文件和.c文件,在调用的<em>时候</em>,一直出现<em>undefined</em> <em>reference</em> to 。。。。 查看代码之后,发现一点问题都没有,就是一直编译不过。 也在C的头文件加入了: #ifdef __cplusplus extern "C" { #endif // my code #ifdef __cplusplus } #endif
使用NDK编译的时候出现 undefined reference to
最近一段时间在使用NDK进行编译的<em>时候</em>一直出现<em>undefined</em> <em>reference</em> to的问题 代码写的没有问题, 在visual studio中也能找到定义, 可是在NDK中就是出现这个问题过不去. 使用nm, objdump 查看.o文件也是发现就是那几个函数未定义; 多番GOOGLE之下 找到了问题所在 解决问题:  在android.mk中加入  LOCAL_AL
android NDK开发遇到 undefined reference to
我现在有一个android 的工程,有一个des.h头文件和des.cpp、NZEncryption.c两个文件,一些函数在des.h头文件中声明,在des.cpp中实现。然后在NZEncryptio
ndk异常:error: undefined reference to 'atof'
今天在编译C++算法库时,发生了如下<em>错误</em>: <em>error</em>: <em>undefined</em> <em>reference</em> to 'atof' 查阅相关资料发现,由于在android-16以后,这个atof的C语言标准库中的函数,在NDK中是内联的,换句话说也就是atof并不是一个库函数,它在内部调用了另一个标准库函数strtod: static __inline__ double atof(const char
undefined reference to错误
g++.exe F:\programme\ll.o -o F:\programme\ll.exe -Wall -fpermissive -Wno-sign-compare -grnF:\programme\ll.o(.text+0x29d): In function `ZN7Account4rateEd':rnF:/programme/ll:27: <em>undefined</em> <em>reference</em> to `Account::interestRate'rncollect2: ld returned 1 exit statusrnFailurernrnrn这是<em>错误</em>提示。请大家帮帮忙
undefined reference to winmain@16'错误
#include rnrnint mian(void)rnrn printf("the begin\n");rn goto end;rnrn printf("hello world");rnend:rn printf("the end\n");rn return 0;rnrnrnrn有一个<em>错误</em>“<em>undefined</em> <em>reference</em> to winmain@16” 这是为什么呢?
undefined reference to `WinMain@16'错误
#include rn#include rnrnfloat add_em(long int a, float b)rnrn float result;rn result=a+b;rn return(result);rnrnrnvoid mian(void)rnrn long int i;rn float result =0;rn time_t start_time, stop_time;rn printf("working... \n");rn time(&start_time);rn for (i=1;igcc functovr.c -g -o functovrrnC:/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/../../../libmingw32.a(main.o)(.text+0xrn97):main.c: <em>undefined</em> <em>reference</em> to `WinMain@16'
undefined reference to 'consine' 错误
我写了在一个文件中写了两个函数:consine(),consine_sve();利用consine_svc()去调用consine(),在生成.o文件时出现<em>错误</em><em>undefined</em> <em>reference</em> to 'consine',请问是为什么?
NDK编译出现 error: undefined reference to 错误
NDK编译出现 <em>error</em>: <em>undefined</em> <em>reference</em> to <em>错误</em>     最近由于项目需求,需要把工程原来使用的静态库文件(*.a)全部转换成动态库(*.so)。    本来linux环境下可以成功编译成静态库的,可是编译动态库的<em>时候</em>出现了很多<em>error</em>: <em>undefined</em> <em>reference</em> to <em>错误</em> 尝试了很多办法,最终在Android.mk中加入      
错误笔记】NDK编译时出现undefined reference to 'stderr' 问题
文章目录一、问题描述:二、问题分析:三、解决方法:四、android系统版本 和 API 对应表 一、问题描述: NDK版本:<em>ndk</em>16b; 使用 NDK 编译工具编译程序的<em>时候</em>,有时会出现了如下问题: root@XXX_Device:/data/test # ./build.sh [你的源文件路径:行号]: <em>error</em>: <em>undefined</em> <em>reference</em> to 'stderr' coll...
求助大神,NDK编译动态库出现undefined reference to...
Compile thumb : crypto_static <= v3_ncons.c Compile thumb
Error: undefined reference to `glCreateShader'-Android NDK OpenGLES
通过NDK调用OpenGLES时,发现报错许多gl开头的方法未定义,具体如下: 奇怪的是,报错的方法还可以点击去。网上查询结果 大部分是修改让Android.mk 原因是 未配置链接OpenGLES库文件。 可是我用的是Android Studio 2.3.3 NDK<em>开发</em>根本看不到Android.mk,只有一个CMakeList.txt
C++ 编译错误: Error:undefined reference to ` '
-
undefined reference错误
[code=C/C++]#include rnrnusing namespace std;rnrnclass Arnrnpublic :rn static int i;rnrn static void get();rn;rnvoid A::get()rnrn i=1;rn cout<
[Linker error] undefined reference to `*::*' 的问题
有两个比较大的类rn然后就提示链接<em>错误</em>rnrn[Linker <em>error</em>] <em>undefined</em> <em>reference</em> to `*::*'rnrn其中的*号是类名和构造函数,<em>错误</em>的地方在主函数。rn构造函数有声明没定义。而且这两个类的头文件都被包含进来的。rn实在找不出问题出在哪里了?rn高人,高人,在哪里?
linker error undefined reference to 'fork'
学习fork()函数,编译时出现:rnlinker <em>error</em> <em>undefined</em> <em>reference</em> to 'fork'
[Linker error] undefined reference to `WinMain@16'
刚学C++,写的第一个程序就不对rn老师说让写三个文件,一个Account.h,一个Account.cpp,一个主函数的程序(虽然我也不是很懂)rn第一个文件:rn//Account.hrn#include rnusing namespace std;rnclass Accountrnrn public:rn Account(int);rn void setBlance(int);rn int getBlance();rn void credit(int);rn void debit(int);rn private:rn int blance;rn ;rn rn第二个文件:rn//Account.cpprn#include rn#include "Account.h"rnusing namespace std;rnAccount::Account(int num)rnrn setBlance(num);rn rnvoid Account::setBlance(int num)rnrn if(num<<<
Android Jni 编译 error: undefined reference to 错误
最近编译了几个静态库 使用了几个NDK本地库,但是在编写android.mk时并未做链接,所以报了几个<em>错误</em>,类似<em>error</em>: <em>undefined</em> <em>reference</em> to …… 此时一个可能是工程内部文件未正确关联,还有一个就是未关联NDK本地库此时需要在Android.mk 使用LOCAL_LDLIBS变量链接本地库。 具体可以查看:https://developer.android.com/
error: undefined reference to ***
一般原因 1. 没有指定对应的库(.o/.a/.so) 使用了库中定义的实体,但没有指定库(-lXXX)或者没有指定库路径(-LYYY),会导致该<em>错误</em>。 Linux下文件的类型是不依赖于其后缀名的,但一般来讲: .o,是目标文件,相当于windows中的.obj文件 .so 为共享库,是shared object,用于动态连接的,和dll差不多 .a为静态库,是好多个.o合在一起,用于静态连接 2...
Android Studio JNI 报错 - error: undefined reference to 'AndroidBitmap_getInfo'
学习JNI<em>遇到</em>了点坑 网上也能找到解决方案 但是发现不管用 <em>error</em>: <em>undefined</em> <em>reference</em> to 'AndroidBitmap_getInfo' <em>error</em>: <em>undefined</em> <em>reference</em> to 'AndroidBitmap_lockPixels' <em>error</em>: <em>undefined</em> <em>reference</em> to 'AndroidBitmap_unlockPix
通过jni移植pjsip协议到android上出现error: undefined reference to 'srand'
这是Android.mk文件: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libtwolib_0 LOCAL
error: undefined reference to 'getdtablesize' on Android
在Android<em>开发</em>中,使用getdtablesize函数编译报错。解决办法:使用sysconf(_SC_OPEN_MAX)代替getdtablesize(), Android NDK21之后不在支持getdtablesize。参考:https://groups.google.com/a/chromium.org/forum/#!topic/chromium-reviews/ihfvaDjcWqs...
error: undefined reference to `vtable for 类名'
win7 + mingw32位+Qt5.10rnrn通过QtCreator创建一个继承自QDialog的类,没有加上任何代码,直接编译运行,结果显示rn<em>error</em>: <em>undefined</em> <em>reference</em> to `vtable for 类名'rnrn如果注释掉类头文件李的Q_OBJECT宏,编译通过,运行正常,rnrn然后加入若干按钮,布局,没有添加信号与槽,也没有用到Q_OBJECT宏,编译,运行都正常rn然后应为需要用到信号和曹,所以必须添加Q_OBJECT宏,添加完后编译,显示rnrn<em>error</em>: <em>undefined</em> <em>reference</em> to `vtable for 类名'rn打开类对应的moc文件,发现文件内容为空白,度娘唯一解决办法是删掉对应的moc文件重新编译(吐槽下现在的博客,一篇文章会被转载N次,然后搜索到的答案就只有一个,,,,)rn我删除了除源代码之外所有的文件,重新编译,单任然显示<em>error</em>: <em>undefined</em> <em>reference</em> to `vtable for 类名'rnrn我切换到命令行模式rnqmake -projectrnqmake xxx.prornmingw32-makern编译还是显示:<em>error</em>: <em>undefined</em> <em>reference</em> to `vtable for 类名'rnrn请问下这个该怎么解决rnrn以下是出错头的一个文件的完整代码,只要类添 加Q_OBJECT宏就会出现这个问题rn[code=c]#ifndef LOADINGDIALOG_Hrn#define LOADINGDIALOG_Hrnrn#include rn#include rn#include rn#include rn#include rn#include rn#include rnrnclass MocTest : public QDialogrnrn Q_OBJECTrnprivate:rn QLineEdit* account_LineEdit;rn QLineEdit* passWD_LineEdit;rnrn QCheckBox* rememberPassWd_CheckBox;rn QCheckBox* autoLoad_CheckBox;rn QPushButton* infoPix_PushButton;rnrnpublic:rn MocTest(QWidget* parent = 0);rn ~MocTest();rn//signals:rn //void loadSuccessful();rn //void loadFail();rn;rnrn#endif // LOADINGDIALOG_H[/code]
NDK引用自定义函数库,undefined reference问题。
用NDK的示例hello-jnirnd:\Android\android-<em>ndk</em>-r7\samples\hello-jni\jni\rn在里面调用我自己的cpp函数库。rn函数库在D:\MyLibrn已经写了LOCAL_C_INCLUDES += /cygdrive/d/MyLibrn编译的<em>时候</em>可以找到MyLib里的头文件,但只要一引用里面的类,就出编译<em>错误</em><em>undefined</em> <em>reference</em>提示没有找到函数实现。rn似乎是要把MyLib里的cpp文件加到LOCAL_SRC_FILES里,但LOCAL_SRC_FILES里的文件都是相对LOCAL_PATH来的。rnrn问题:rn1、怎么让NDK编译时自动搜索D:\MyLib里的cpp文件?rn2、如果不能自动,必须要把用到的cpp文件一个个的填到LOCAL_SRC_FILES里,怎样引用D:\MyLib而不把D:\MyLib复制到d:\Android\android-<em>ndk</em>-r7\samples\hello-jni\jni\下?
undefined reference to 错误的解决方法总结
在编写C++时,会<em>遇到</em>一类<em>错误</em>的错。 总结起来为几类 一、是 Linux环境<em>错误</em>  具体没有深入研究,可以参考http://blog.csdn.net/cserchen/article/details/5503556。 二、使用codeblock这类需要自己配置路径,要把所有文件添加到Build target中。配置方法参考下面两个博客:       http://blog.csdn.
.so里面undefined reference错误
我现在用libZThread这个库。用的<em>时候</em>出现了问题rn/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libZThread.so: <em>undefined</em> <em>reference</em> to `pthread_mutex_trylock'rn/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libZThread.so: <em>undefined</em> <em>reference</em> to `pthread_key_create'rn/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libZThread.so: <em>undefined</em> <em>reference</em> to `pthread_getspecific'rn/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libZThread.so: <em>undefined</em> <em>reference</em> to `pthread_create'rn/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libZThread.so: <em>undefined</em> <em>reference</em> to `pthread_key_delete'rn/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libZThread.so: <em>undefined</em> <em>reference</em> to `pthread_setspecific'rn/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libZThread.so: <em>undefined</em> <em>reference</em> to `pthread_join'rnrn我认为是说libZThread里面用了pthread线程库,但是链接失败。 刚开始是LINKFLAGS没加-lpthread,后面加了还是有这个<em>错误</em>输出。 谁知道什么问题吗?
安卓 jni 开发错误 undefined reference to __android_log_print
安卓 jni <em>开发</em><em>错误</em> <em>undefined</em> <em>reference</em> to __android_log_print
NDK编译时,报错error: undefined reference to 'rand',是不是安卓库函数里面没有这个函数的实现呢?
如题。是不是要自己重新定义rand()srand()函数呢?<em>ndk</em>-build具体的报错如下: $ $NDK/<em>ndk</em>-build Android NDK: WARNING: APP_PLATFORM
ndk-build时各种诡异的undefined reference--
<em>ndk</em>-build时各种诡异的<em>undefined</em> <em>reference</em>解决方法 在编译自己编码的AndroidRTSP播放器网络库时,网络库引用到了Android NDK编译出的live555子模块库,编译会<em>遇到</em><em>遇到</em>报各种 <em>undefined</em> <em>reference</em> to xxxx方法, 但是这些方法有都存在live555的各个模块的库中 我想看编译出来的o文件, 那个c文件对应的o文件存在,A
Androd NDK undefined reference to while linking
For some reason I want to use FreeImage library in my android <em>ndk</em> project ,but while I am building this static library with <em>ndk</em>-build, It compiled the source quite OK, but  failed  during the link ste...
android studio ndk undefined reference to '
 在程序中调用了某个C++类XXX,但是没有把该类的源文件 XXX.cpp 加入到Android.mk文件的LOCAL_SRC_FILES变量中. 调用某个函数***(),但是没有将该函数实现的*.c 源文件加入到Android.mk文件的LOCAL_SRC_FILES变量中. <em>error</em> :first in use function 当前头文件没有加进来
模板类 出现undefined reference to错误
[code=C/C++]rnlinearlist.cpprnrn#include "linearlist.h"rntemplate rnLinearList::LinearList(int nMaxSize)rnrn nMaxListSize = nMaxSize;rn length = 0;rn element = new T[nMaxSize];rnrntemplate rnLinearList::~LinearList()rnrn delete []element;rnrntemplate rnbool LinearList::IsEmpty()constrnrn return length==0;rnrntemplate rnint LinearList::GetLength()constrnrn return length;rnrntemplate rnbool LinearList::Find(int k,T& x)constrnrn if(klength)rn return false;rn x = element[k-1];rn return true;rnrntemplate rnint LinearList::Search(const T& x)constrnrn for(int i=0;irnbool LinearList::Delete(int k,T &x)rnrn if(Find(k,x))rn rn for(int i=k;irnbool LinearList::Insert(int k,const T &x)rnrn if(klength)rn return false;rn if(length == nMaxListSize)rn return false;rn for(int i=length-1;i>=k;i--)rn rn element[i+1] = element[i];rn rn element[k] = x;rn length++;rn return true;rnrntemplate rnvoid LinearList::OutPut(ostream &out) constrnrn for(int i=0;irnostream &operator<<rncollect2: ld returned 1 exit statusrnrn望高手指教rn[/code]
错误求助 undefined reference to `_imp__waveOutGetVolume@8'
[code=c]#include "mainwindow.h"rn#include rn#include rn#include rn#include rn#pragma comment(lib,"winmm.lib")rnrnint main(int argc, char *argv[])rnrn QApplication a(argc, argv);rn MainWindow w;rn w.show();rnrn DWORD lvol;rn waveOutGetVolume(0,&lvol);rn qDebug()<< lvol;rnrn return a.exec();rnrn[/code]rnrn<em>错误</em>信息rndebug/main.o: In function `Z5qMainiPPc':rnC:\Users\redee\Documents\build-TEST-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../TEST/main.cpp:15: <em>undefined</em> <em>reference</em> to `_imp__waveOutGetVolume@8'rncollect2.exe: <em>error</em>: ld returned 1 exit statusrnrn实在查不到相关信息,求助。
编译出现undefined reference 错误
我现在看的是一个项目中的某部分,项目文件总共大小有50M。我在项目的src源码中的一个模块(例如:osdc)中,增加了两个文件add.cc,add.h.原osdc下面有文件(a.h, a.cc, b.h, b.cc, f.h, f.cc等),其中我实现的<em>时候</em>在a.h中包含了add.h(代码如下:),同时我有add.cc实现了.h中的函数。rn[code=c]#ifndef ADD_Hrn#define ADD_Hrnrntypedef unsigned int usInt;rntypedef char usChar;rn//#define SIZE 300*1024rn#define ArraySize 1024*1024*2rn#define BLOCK_MAX_SIZE 1024*1024rnclass Robin rn public:rn usInt **TA;rn usInt **TB;rn usInt **TC;rn.....rnint rabin(usChar * array,BlockLIinkList* blockLinkList);rn.....rn;rn#endif[/code]rnrn在a.cc中使用:[code=c]rn.....rnBlockLIinkList *blockLinkList = NULL;//使用rabin分块rn Robin *robin = new Robin();rn robin->rabin(temp_data,blockLinkList);rn......rn[/code]rnrn之后,我就执行./configure,然后make,make的<em>时候</em>就出现<em>错误</em>说rn<em>undefined</em> <em>reference</em> to `Robin::rabin(char*, BlockLIinkList*)。rn我不知道是不是因为./configure生成Makefile的<em>时候</em>,不认识我添加的文件(我不熟悉Makefile),我查看通过make之后生成的Makefile时发现,osdc下面除了我新加入的文件add.cc没有,其他所有的.cc文件在Makefile中都能搜索到。rnrn我希望能大家帮帮我,解决这个问题,非常感谢!还有就是针对这种大型项目,如果我增加新的文件的<em>时候</em>需要注意什么?
求救! undefined reference to `vtable for ***错误
/*register.h*/rnpublic:rn explicit regist(QWidget *parent = 0);rn virtual ~regist();rnrn/*register.cpp*/rnregist::~regist()rnrn delete ui;rnrn <em>错误</em>:<em>undefined</em> <em>reference</em> to `vtable for regist'rn这是在别的文件copy下来的,那个没有<em>错误</em>,怎么这个就出错了。rn求大哥大姐们帮帮忙,SOS!!!!
undefined reference to错误如何解决
想写一个在后台监视短信的exe程序,rnMyStart.cpprnrn#include rn#include rn#include // Consolern#include "MyObserver.h"rnrn_LIT(KTextConsoleTitle, "Console");rn_LIT(KTextFailed, " failed, leave code = %d");rn_LIT(KTextPressAnyKey, " [press any key]\n");rnrnLOCAL_D CConsoleBase* console; // write all messages to thisrnrnLOCAL_C void DoStartL()rn rn // Create active scheduler (to run active objects)rn CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();rn CleanupStack::PushL(scheduler);rn CActiveScheduler::Install(scheduler);rnrn CMyObserver* observer = CMyObserver::NewL(*console);rn observer->Load();rn //CActiveScheduler::Start();rn // Delete active schedulerrn CleanupStack::PopAndDestroy(scheduler);rn rnrnGLDEF_C TInt Start()rn rn // Create cleanup stackrn __UHEAP_MARK;rn CTrapCleanup* cleanup = CTrapCleanup::New();rnrn // Create output consolern TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen)));rn if (createError)rn return createError;rnrn // Run application code inside TRAP harness, wait keypress when terminatedrn TRAPD(mainError, DoStartL());rn if (mainError)rn console->Printf(KTextFailed, mainError);rn console->Printf(KTextPressAnyKey);rn console->Getch();rn rn delete console;rn delete cleanup;rn __UHEAP_MARKEND;rn return KErrNone;rn rnrnrn// Exported Functionsrnrn#ifdef __WINS__rnEXPORT_C TInt WinsMain(TAny* /*aParam*/)rn rn return Start();rn rn#elsernGLDEF_C TInt E32Main()rn rn return Start();rn rn#endifrnrn#ifdef __WINS__rnTInt E32Dll(TDllReason /*aReason*/)rn rn return KErrNone;rn rn#endifrnrnrn// End of filernrnMyObserver.hrn#ifndef MYOBSERVER_Hrn#define MYOBSERVER_Hrnrn// INCLUDESrn// System Includesrn#include // CBase, link against euser.librn#include rn#include rnrn// FORWARD DECLARATIONSrn//class MyClass;rnclass CConsoleBase;rnrn// CLASS DECLARATIONrnrnclass CMyObserver : public CBase, public MMsvSessionObserverrn rn public: // Constructors and destructorrn static CMyObserver* NewL(CConsoleBase& aConsole);rn static CMyObserver* NewLC(CConsoleBase& aConsole);rn virtual ~CMyObserver();rnrn public: // Functions from base classesrn void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3 );rn void Load();rn private: // Constructorsrn CMyObserver(CConsoleBase& aConsole);rn void ConstructL();rnrn private: // Datarn CMsvSession* iMsvSession;rn CMsvEntry* iMsvEntry;rn CConsoleBase& iConsole;rn TMsvId iNewMessageId;rn ;rnrn#endif // MYOBSERVER_HrnrnMyObserver.cpprn#include "MyObserver.h"rnrn// System includesrn#include rn#include rn#include // For CBase, link against euser.librn#include rn#include rnrn//#include rn// User includesrn//#include "MyHeaderFile.h"rnrn#ifdef __WINS__rnconst TMsvId KObservedFolderId = KMsvDraftEntryId;rn#elsernconst TMsvId KObservedFolderId = KMsvGlobalInBoxIndexEntryId;rn#endifrnrn// ================= MEMBER FUNCTIONS =======================rnrnCMyObserver::CMyObserver(CConsoleBase& aConsole) :rniConsole(aConsole)rn rn rnrnCMyObserver::~CMyObserver()rn rn delete iMsvSession;rn delete iMsvEntry;rn rnrnCMyObserver* CMyObserver::NewLC(CConsoleBase& aConsole)rn rn CMyObserver* self = new (ELeave) CMyObserver(aConsole);rn CleanupStack::PushL(self);rn self->ConstructL();rn return self;rn rnrnCMyObserver* CMyObserver::NewL(CConsoleBase& aConsole)rn rn CMyObserver* self = CMyObserver::NewLC(aConsole);rn CleanupStack::Pop(self);rn return self;rn rnrnvoid CMyObserver::ConstructL()rn rn iMsvSession = CMsvSession::OpenAsyncL(*this);rn rnrnvoid CMyObserver::Load()rn rn rnrnvoid CMyObserver::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* /*aArg3*/)rn rn rnrnarmi urel 的<em>时候</em>出现如下<em>错误</em>,还望各位帮帮忙啊rn..\..\..\..\EPOC32\BUILD\SYMBIAN\8.1A\S60_2ND_FP3\SERIES60EX\DATASF\MYSTART\GROUP\MYSTART\ARMI\UREL\MYSTART.in(../../../../EPOC32/BUILD/SYMBIAN/8.1A/S60_2ND_FP3/SERIES60EX/DATASF/MYSTART/GROUP/MYSTART/ARMI/UREL/MYOBSERVER.o)(.text+0x11c):Myobserver.cpp: <em>undefined</em> <em>reference</em> to `CMsvSession::OpenAsyncL(MMsvSessionObserver &)'rnmake: *** [..\..\..\..\EPOC32\RELEASE\ARMI\UREL\MYSTART.EXE] Error 1rnERROR: RCMake failed: (Make): make command exited with result 2. (Reason: The system cannot find the file specified.)rn
NDK编译报错 undefined reference to 'vtable for
jni/FaceDetection/include/classifier.h:49: <em>error</em>: <em>undefined</em> <em>reference</em> to 'vtable for seeta::fd::SURFMLP' D:/android/android-<em>ndk</em>-r10/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../
NDK undefined reference to 问题解决
很久没有用NDK<em>开发</em>写C/C++ 代码了,前几天需要用到,编译的<em>时候</em>报了个<em>undefined</em> <em>reference</em> to链接问题,其实很简单,怕再次忘记,把解决方案做个笔记。 在Android.mk文件中把xxx.c文件写入LOCAL_SRC_FILES :=中       另外一种方案: 在android.mk中加入  LOCAL_ALLOW_UNDEFINED_SYMBOL
android ndk开发支持64位时遇到undefined reference to `__system_property_get'
android 做守护进程时用<em>ndk</em>实现,但是打包执行文件时要支持android5.1以上的64位手机时<em>遇到</em><em>undefined</em> <em>reference</em> to `__system_property_get',打包不成功,最后百度谷歌找到http://www.bubuko.com/infodetail-1014879.html这篇文章看到问题原因和解决方案,原文原因: 下面这一系列的函数在arm64的头
android注入.so时遇到error: undefined reference to 'dlopen'
参照http://blog.csdn.net/lingfong_cool/article/details/7949726 编译inject时<em>遇到</em>rnrnprebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/generic/obj/EXECUTABLES/inject_intermediates/inject.o: in function inject_remote_process:inject/inject.c:472: <em>error</em>: [color=#FF0000]<em>undefined</em> <em>reference</em> to 'dlopen'[/color]rnprebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/generic/obj/EXECUTABLES/inject_intermediates/inject.o: in function inject_remote_process:inject/inject.c:472: <em>error</em>: [color=#FF0000]<em>undefined</em> <em>reference</em> to 'dlsym'[/color]rnprebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/generic/obj/EXECUTABLES/inject_intermediates/inject.o: in function inject_remote_process:inject/inject.c:472: <em>error</em>: [color=#FF0000]<em>undefined</em> <em>reference</em> to 'dlclose'[/color]rncollect2: ld returned 1 exit statusrnmake: *** [out/target/product/generic/obj/EXECUTABLES/inject_intermediates/LINKED/inject] <em>错误</em> 1rnmake:离开目录“/root/Android”rnrn这是我的android.mkrn[code=text]LOCAL_PATH:= $(call my-dir)rninclude $(CLEAR_VARS)rnrnLOCAL_SRC_FILES:= rn inject.c rn shellcode.srnrnLOCAL_MODULE:= injectrnLOCAL_SHARED_LIBRARIES := liblogrnLOCAL_STATIC_LIBRARIES := libcrnLOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llogrnLOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)rnLOCAL_MODULE_TAGS := debugrnrninclude $(BUILD_EXECUTABLE)[/code]rnrn[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/4.gif][/img][color=#FF6600]求指导,求教育。[/color]不是说好有很多人编译通过里的吗。。。
undefined reference to ....
http://codepad.org/7x4aaR3D 不知道问题是什么。。。
undefined reference
编译时出错:rn.o /e/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/pcre_exec.o /e/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/pcre_ord2utf8.o /e/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/pcre_newline.o /e/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/pcre_fullinfo.o /e/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/pcre_xclass.o -L/e/pocobuild/lib/MinGW/ia32 -liphlpapi -lws2_32 -lpcrernCreating library file: e:/pocobuild/lib/MinGW/ia32/libPocoFoundationd.arne:/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/LoggingFactory.o(.text$_ZNK4Poco12InstantiatorINS_15EventLogChannelENS_7ChannelEE14createInstanceEv[Poco::Instantiator::createInstance() const]+0x59): In function `ZN4Poco12InstantiatorINS_17FormattingChannelENS_7ChannelEED1Ev':rne:/poco-1.3.1-data/Foundation/include/Poco/Instantiator.h: <em>undefined</em> <em>reference</em> to `Poco::EventLogChannel::EventLogChannel()'rne:/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/LoggingFactory.o(.text$_ZNK4Poco12InstantiatorINS_21WindowsConsoleChannelENS_7ChannelEE14createInstanceEv[Poco::Instantiator::createInstance() const]+0x59):e:/poco-1.3.1-data/Foundation/include/Poco/Instantiator.h: <em>undefined</em> <em>reference</em> to `Poco::WindowsConsoleChannel::WindowsConsoleChannel()'rne:/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/SyslogChannel.o(.text+0x6e4): In function `ZN4Poco13SyslogChannel4openEv':rne:/poco-1.3.1-data/Foundation/src/SyslogChannel.cpp:76: <em>undefined</em> <em>reference</em> to `openlog'rne:/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/SyslogChannel.o(.text+0x702): In function `ZN4Poco13SyslogChannel5closeEv':rne:/poco-1.3.1-data/Foundation/src/SyslogChannel.cpp:85: <em>undefined</em> <em>reference</em> to `closelog'rne:/pocobuild/Foundation/obj/MinGW/ia32/debug_shared/SyslogChannel.o(.text+0x762): In function `ZN4Poco13SyslogChannel3logERKNS_7MessageE':rne:/poco-1.3.1-data/Foundation/src/SyslogChannel.cpp:94: <em>undefined</em> <em>reference</em> to `syslog'rnrn看样子是是缺少可查了很久rn第一我包含了//这个只有openlog(),closelog()的声明,缺没有定义,rn我不知道到底怎么回事?是不是g++时 没有带什么<em>时候</em>-l参数如果缺少库是缺那个我也不知道,望高手指点rn
Undefined reference
在学习Computer System这本书rn看到第十二章, 按照书上的代码敲了一个Web Server出来rn[code=C/C++]rn#include "csapp.h"rnrnvoid echo(int connfd);rnrnint main( int argc, char **argv)rnrn int listenfd, connfd, port, clientlen;rn struct sockaddr_in clientaddr;rn struct hostent *hp;rn char *haddrp;rn rn if(argc != 2)rn rn fprintf(stderr, "Usage: %s \n", argv[0]);rn exit(0);rn rn port = atoi(argv[1]);rn rn listenfd = Open_listenfd(port);rn while(1)rn rn clientlen = sizeof(clientaddr);rn connfd = accept(listenfd, (SA *)&clientaddr, &clientlen);rn rn hp = Gethostbyaddr( (const char *)&clientaddr.sin_addr.s_addr, sizeof(clientaddr.sin_addr.s_addr), AF_INET); rn haddrp = inet_ntoa(clientaddr.sin_addr);rn printf("Server connected to %s (%s)\n", hp->h_name, haddrp);rn rn echo(connfd);rn Close(connfd);rn rn rn exit(0);rnrnrnvoid echo(int connfd)rnrn size_t n;rn char buf[MAXLINE];rn rio_t rio;rn rn Rio_readinitb(&rio,connfd);rn while( (n = Rio_readlineb(&rio, buf, MAXLINE)) != 0)rn rn printf("Server received %d bytes\n", n);rn Rio_writen(connfd, buf, n);rn rnrnrn[/code]rnrnrnrn在Ubuntu 64bit下面rngcc -Wall server.c -o serverrnrn编译器报错:rn<em>undefined</em> <em>reference</em> to "Open_listenfd"rn<em>undefined</em> <em>reference</em> to "Gethostbyaddr"rn<em>undefined</em> <em>reference</em> to "Close"rnrn<em>undefined</em> <em>reference</em> to "Rio_readinitb"rn<em>undefined</em> <em>reference</em> to "Rio_writen"rn<em>undefined</em> <em>reference</em> to "Rio_readlineb"rnrnrn头文件 csapp.h我是从教材的官网上下载的rn我也看过了, 上面这些“<em>undefined</em>”的函数, 在头文件里面也有。rnrn不明白为什么编译器报错, 望指教!rnrn谢谢!
急!!!Qt编程error: undefined reference to `RTPSession::~RTPSession()'错误
我在网上下了一个example的例子:example.cpp文件如下。rn/*rn Here's a small IPv4 example: it asks for a portbase and a destination and rn starts sending packets to that destination.rn*/rnrn#include "rtpsession.h"rn#include "rtpudpv4transmitter.h"rn#include "rtpipv4address.h"rn#include "rtpsessionparams.h"rn#include "rtp<em>error</em>s.h"rn#ifndef WIN32rn #include rn #include rn#elsern #include rn#endif // WIN32rn#include rn#include rn#include rn#include rnrn//rn// This function checks if there was a RTP <em>error</em>. If so, it displays an <em>error</em>rn// message and exists.rn//rnrnvoid check<em>error</em>(int rtperr)rnrn if (rtperr < 0)rn rn std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl;rn exit(-1);rn rnrnrn//rn// The main routinern//rnrnint main(void)rnrn#ifdef WIN32rn WSADATA dat;rn WSAStartup(MAKEWORD(2,2),&dat);rn#endif // WIN32rn rn RTPSession sess;rn uint16_t portbase,destport;rn uint32_t destip;rn std::string ipstr;rn int status,i,num;rnrn // First, we'll ask for the necessary informationrn rn std::cout << "Enter local portbase:" << std::endl;rn std::cin >> portbase;rn std::cout << std::endl;rn rn std::cout << "Enter the destination IP address" << std::endl;rn std::cin >> ipstr;rn destip = inet_addr(ipstr.c_str());rn if (destip == INADDR_NONE)rn rn std::cerr << "Bad IP address specified" << std::endl;rn return -1;rn rn rn // The inet_addr function returns a value in network byte order, butrn // we need the IP address in host byte order, so we use a call torn // ntohlrn destip = ntohl(destip);rn rn std::cout << "Enter the destination port" << std::endl;rn std::cin >> destport;rn rn std::cout << std::endl;rn std::cout << "Number of packets you wish to be sent:" << std::endl;rn std::cin >> num;rn rn // Now, we'll create a RTP session, set the destination, send somern // packets and poll for incoming data.rn rn RTPUDPv4TransmissionParams transparams;rn RTPSessionParams sessparams;rn rn // IMPORTANT: The local timestamp unit MUST be set, otherwisern // RTCP Sender Report info will be calculated wrongrn // In this case, we'll be sending 10 samples each second, so we'llrn // put the timestamp unit to (1.0/10.0)rn sessparams.SetOwnTimestampUnit(1.0/10.0); rn rn sessparams.SetAcceptOwnPackets(true);rn transparams.SetPortbase(portbase);rn status = sess.Create(sessparams,&transparams); rn check<em>error</em>(status);rn rn RTPIPv4Address addr(destip,destport);rn rn status = sess.AddDestination(addr);rn check<em>error</em>(status);rn rn for (i = 1 ; i rn请问有没有大神能解释一下啊,刚接触Qt编程,很多不是很懂,纠结了很久了。rn
android ndk编译C++ 的undefined reference to '__cxa_end_cleanup'及 __gxx_personality_v0问题
出现这两个<em>错误</em>主要是由于缺少stl支持导致的。 android 的<em>ndk</em>默认是不带 stl相关属性的 这就导致他编译C++代码的<em>时候</em>有<em>时候</em>会链接失败,报一些函数找不到。 比如这两个: __cxa_end_cleanup  和  __gxx_personality_v0   这些stl相关的库不在$(NDK_ROOT)/platforms/
【Android-NDK】错误 undefined reference to '__atomic_fetch_add_4'
不罗嗦,在Android.mk文件中,添加: LOCAL_LDLIBS += -latomic 费了好大劲才解决。 环境:cygwin64,gcc4.9.2
linux下make时出现error:undefined reference to 'log'
求助: 在linux下进入src文件 make后出现了 <em>error</em>:<em>undefined</em> <em>reference</em> to 'log' 初次接触linux,请大家赐教, makefile文件是这样子的 # MI
解决undefined reference to `log' 的问题
今天编译一下《linux程序设计》中的一个例子,编译时总出现"<em>undefined</em> <em>reference</em> to `log' "<em>错误</em>,后来将命令改‘gcc -lm XX.c -o XX’即可,原因是程序例子中用到了math.h,那么在用gcc进行编译的<em>时候</em>,必须加上-lm选项。
cocos引用iconv库在android编译,错误undefined reference libiconv_open,libiconv_close
<em>ndk</em>有自动iconv库 NDK自带的iconv的 查看 android-<em>ndk</em>-r10e/sources/android/support/include/iconv.h 在项目android.mk里面加入 LOCAL_WHOLE_STATIC_LIBRARIES += android_support $(call import-module,andorid/support)
[Linker error] undefined reference to `WinMain@16'什么意思?
我用dev-cpp编译rn#include rnusing namespace std;rnclass outputrnpublic:rn output()cout<<<rn怎么回事?
error: undefined reference to `Circle::Circle()' and `Rectangle::Rectangle()'
题目如下:rn[quote]以点(Point)类为基类,重新派生类 Rectangle、Circle。坐标原点为(0,0),矩形水平放置,由左下方的顶点和长宽定义。rnrn圆由圆心和半径定义。派生类操作判断任一坐标点是在图形内,还是在图形的边缘上,还是在图形外。rnrn缺省初始化图形退化为坐标原点(0,0)rnrn要求拷贝构造函数和定义默认构造函数rnrn编程测试类设计是否正确。rnrnclass Pointrnrnprivate:rn double x,y;rnpublic:rn Point();rn Point(double xv,double yv);rn Point(Point& pt);rn double getx();rn double gety();rn;rn rn类Circle 和类Rectangle 都包含成员函数:int position(Point &pt)。 rn rn假如点A落在圆内或是矩形内,则该函数返回-1;如果落在圆上或是矩形上,则返回0,;如果落在外面,则返回1。rn rn主函数:rnint main()rnrn Circle cc1(3,4,5);rn Rectangle rt1(0,0,6,8);rn Point p1(0,0);rn cout<<< temp0)rn rn ireturn = -1;rn rn elsern rn ireturn = 1;rn rn return ireturn;rnrnclass Rectangle:public Pointrnrnprotected:rn int length,width;rnpublic:rn Rectangle();rn Rectangle(double x,double y,int length,int width):Point(x,y),length(length),width(width)rn int getlength() const return length;rn int getwidth() const return width;rn int position(Point &pt);rn;rnint Rectangle::position(Point& pt)rnrn int ireturn = 0;rn rn if (pt.getx()==x||pt.gety()==y||pt.getx()==x+length||pt.gety()==y+width)rn rn ireturn = 0;rn rn else if (pt.getx()>x&&pt.getx()y&&pt.gety()
Dev C++提示Error:“undefined reference to ……”
当我用Dev C++编译一个源文件时就会提示这句话,rn其中“……”是我在头文件中定义的类的构造函数等,格式一般是这样的:rnClassNmae::ClassName(argument1, argument2, argument3, ……)rn如果只是一个.cpp文件,就是不含.h文件的程序,都可以编译成功。rn怎么解决啊?
编译错误:[Linker error] undefined reference to `fork'
我用dev-c++编写如下程序:rn#include rn#include rn#include rn#include rnint main(int argc, char* argv[])rnrn printf("hello\n");rn fork();rn printf("bye\n");rn system("PAUSE"); rn return 0;rnrnrn编译时出现 [Linker <em>error</em>] <em>undefined</em> <em>reference</em> to `fork' rn该如何解决?谢谢。
[build error] undefined reference to symbol 'XInitThreads'
编译Android源代码时报错,<em>错误</em>提示如下:rncompile the Main_*.java filesrndxconverter test suite sucessfully built!rnintermediate Main_*.java files (for stacktrace analysis) can be found under out/host/linux-x86/obj/EXECUTABLES/dx-tests_intermediates/mainfilesrnInstall: out/host/linux-x86/bin/dx-testsrnhost Executable: emulator_renderer (out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer)rn/usr/bin/ld: out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/main.o: <em>undefined</em> <em>reference</em> to symbol 'XInitThreads'rn/usr/bin/ld: note: 'XInitThreads' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command linern/usr/lib/libX11.so.6: could not read symbols: Invalid operationrncollect2: ld returned 1 exit statusrnmake: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer] Error 1rn[xoxo@Xoxo Android]$ emulatorrnemulator: ERROR: No initial system image for this configuration!rnrn求解!
编译时出现undefined reference to `libiconv_open’的解决办法
编译时出现<em>undefined</em> <em>reference</em> to `libiconv_open’的解决办法 这是什么问题呢?其实是缺少libiconv库的原因。 1.libiconv包的下载路径 包的下载页面http://www.gnu.org/software/libiconv/ The latest release ishttps://ftp.gnu....
android studio build报错error: undefined reference to 'std::
Error:<em>error</em>: <em>undefined</em> <em>reference</em> to 'std::logic_<em>error</em>::logic_<em>error</em>(char const*)' Error:<em>error</em>: <em>undefined</em> <em>reference</em> to 'std::logic_<em>error</em>::logic_<em>error</em>(char const*)' Error:<em>error</em>: <em>undefined</em> <em>reference</em> to 's...
ROS报错:In function `......': xxx.cpp undefined reference to '......'
报错内容如下: MakeFiles/side_detection_node.dir/side_detection_node.cpp.o: In function `roborts_detection::SideDetectionNode::DetectionThread()': side_detection_node.cpp:(.text+0xb71): <em>undefined</em> <em>reference</em> t...
对于undefined reference stderr问题的解决
对于<em>undefined</em> <em>reference</em> stderr问题的解决
安卓编译caffe错误undefined reference to `stderr'’
NDK:android-<em>ndk</em>-r15c caffe:https://github.com/sh1r0 编译<em>错误</em>: [ 76%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/insert_splits.cpp.o [ 77%] Building CXX object src/caffe/CMakeFiles/caffe.di
[Linker error] undefined reference to `statictest::sum'
我写的小程序在dev-cpp 4.9.9.2 和VC++ 6.0 里面都不能编译通过。rn在dev-cpp里面显示<em>错误</em>为Linker <em>error</em>] <em>undefined</em> <em>reference</em> to `statictest::sum' rnrnrn#include rnrnusing namespace std;rnrnrnclass statictestrnrnpublic:rn static int sum; rn rnpublic:rn /*rn int getsum()rn rn return sum;rn rn rn statictest()rn rn rn sum = 0; rn rn rn void add()rn rn sum++; rn rn */rn rn static void printsum()rn rn rn cout<<
链接时遇到undefined reference to ‘xxx’ 的解决方案
链接时<em>遇到</em>的 <em>undefined</em> <em>reference</em> to ‘xxx’ 的解决方案。 注意:加上库时,要记得把该库的地址也加上去。 1.<em>undefined</em> <em>reference</em> to `cuInit' 加上库  -lcuda   2.  <em>undefined</em> <em>reference</em> to symbol '_ZN5boost6system15system_categoryEv' ...
编译caffe时遇到undefined reference to的问题
在ubantu16.04版本的linux系统中编译caffe时<em>遇到</em>两个<em>undefined</em> <em>reference</em> to的路径问题,在尝试多个方法后,总结解决方法: 1.<em>undefined</em> <em>reference</em> to `google::protobuf::Message::InitializationErrorString() const'  即: 方法一:caffe的预装软件protobuff版
交叉编译tslib,遇到undefined reference to rpl_malloc错误解决办法
执行autogen.sh后,修改config.h.in 把里面的#undef malloc,然后就编译通过了。
编译Linux时遇到undefined reference to
最近在向Linux中添加一些驱动,用于支持现行的主板。rn具体为在Linux中添加了两个驱动,一个用于控制CPU的GPIO,一个用于控制主板上的LED灯。rn而控制主板的LED灯的驱动需要依赖于控制GPIO的驱动。于是在GPIO的驱动中,利用EXPORT_SYMBOL导出了两个函数,并单独写了一个头文件给LED灯驱动使用。手工编译这两个模块的<em>时候</em>是OK的,但是通过修改Kconfig和Makefile加到Linux中,直接编译Linux会出现如下<em>错误</em>:rndrivers/built-in.o: In function `led_ioctl':rnpsx610e_led.c:(.text+0xfddc): <em>undefined</em> <em>reference</em> to `pxe_gpio_write'rnpsx610e_led.c:(.text+0xfe28): <em>undefined</em> <em>reference</em> to `pxe_gpio_write'rndrivers/built-in.o: In function `led_init':rnpsx610e_led.c:(.text+0xffcc): <em>undefined</em> <em>reference</em> to `pxe_gpio_write'rnpsx610e_led.c:(.text+0x10010): <em>undefined</em> <em>reference</em> to `pxe_gpio_write'rnrn不知道怎么解决这样的问题。
编译 firefox-3.6,遇到 undefined reference to FcPatternAddFTFace
c++ -I/usr/X11R6/include -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-long-long -pedantic -fno-strict-aliasing -fshort-wchar -pthread -pipe -DNDEBUG -DTRIMMED -Os -freorder-blocks -fno-reorder-functions -fPIC -shared -Wl,-z,defs -Wl,-h,libxul.so -o libxul.so nsStaticXULComponents.o nsUnicharUtils.o nsCompressedCharMap.o nsBidiUtils.o nsRDFResource.o -lpthread -Wl,-rpath-link,/opt/src/mozilla-1.9.2/dist/bin -Wl,-rpath-link,/opt/lib -Wl,--whole-archive ../../embedding/browser/gtk/src/libgtkembedmoz.a ../../toolkit/xre/libxulapp_s.a ../../staticlib/components/libxpconnect.a ../../staticlib/components/libnecko.a ../../staticlib/components/libuconv.a ../../staticlib/components/libi18n.a ../../staticlib/components/libchardet.a ../../staticlib/components/libjar50.a ../../staticlib/components/libpref.a ../../staticlib/components/libcaps.a ../../staticlib/components/libhtmlpars.a ../../staticlib/components/libimglib2.a ../../staticlib/components/libgklayout.a ../../staticlib/components/libdocshell.a ../../staticlib/components/libembedcomponents.a ../../staticlib/components/libwebbrwsr.a ../../staticlib/components/libnsappshell.a ../../staticlib/components/libtxmgr.a ../../staticlib/components/libchrome.a ../../staticlib/components/libcommandlines.a ../../staticlib/components/libtoolkitcomps.a ../../staticlib/components/libpipboot.a ../../staticlib/components/libpipnss.a ../../staticlib/components/libjsctypes.a ../../staticlib/components/libgkplugin.a ../../staticlib/components/libmozfind.a ../../staticlib/components/libappcomps.a ../../staticlib/components/libunixproxy.a ../../staticlib/components/libxpinstall.a ../../staticlib/components/libjsd.a ../../staticlib/components/libautoconfig.a ../../staticlib/components/libauth.a ../../staticlib/components/libcookie.a ../../staticlib/components/libpermissions.a ../../staticlib/components/libuniversalchardet.a ../../staticlib/components/libcomposer.a ../../staticlib/components/librdf.a ../../staticlib/components/libwindowds.a ../../staticlib/components/libintlapp.a ../../staticlib/components/libfileview.a ../../staticlib/components/libstoragecomps.a ../../staticlib/components/libplaces.a ../../staticlib/components/libtkautocomplete.a ../../staticlib/components/libsatchel.a ../../staticlib/components/libpippki.a ../../staticlib/components/libucvmath.a ../../staticlib/components/libwidget_gtk2.a ../../staticlib/components/libsystem-pref.a ../../staticlib/components/libgkgfxthebes.a ../../staticlib/components/libaccessibility.a ../../staticlib/components/libremoteservice.a ../../staticlib/components/libspellchecker.a ../../staticlib/components/libzipwriter.a ../../staticlib/libxpcom_core.a ../../staticlib/libucvutil_s.a ../../staticlib/libgkgfx.a ../../staticlib/libmozreg_s.a ../../staticlib/libmorkreader_s.a ../../staticlib/libgtkxtbin.a ../../staticlib/libgfxpsshar.a ../../staticlib/libthebes.a -Wl,--no-whole-archive -L../../dist/lib -lsqlite3 -L../../dist/bin -L../../dist/lib -L../../dist/bin -L../../dist/lib -L../../jpeg -lmozjpeg -L../../modules/libimg/png -lmozpng ../../gfx/qcms/libmozqcms.a -L/opt/src/mozilla-1.9.2/dist/bin -lmozjs -L../../dist/bin -L../../dist/lib -lcrmf -lsmime3 -lssl3 -lnss3 -lnssutil3 ../../gfx/cairo/cairo/src/libmozcairo.a ../../gfx/cairo/libpixman/src/libmozlibpixman.a -L/usr/X11R6/lib -lXrender -lfreetype -lfontconfig -L../../modules/zlib/src -lmozz -L/opt/src/mozilla-1.9.2/dist/lib -lplds4 -lplc4 -lnspr4 -lpthread -ldl -L/opt/lib -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 -L/usr/X11R6/lib -lX11 -lXext -L/opt/lib -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -L/opt/lib -L/usr/X11R6/lib -lgtk-x11-2.0 -latk-1.0 -lcairo -lXrender -lX11 -lXext -lpng12 -lfreetype -lz -lfontconfig -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lXt -lgthread-2.0 -lfreetype -lz -lasound -ldl -lmrn../../staticlib/libthebes.a(gfxPangoFonts.o)(.text+0x2503): In function `gfxDownloadedFcFontEntry::InitPattern()':rngfxPangoFonts.cpp: <em>undefined</em> <em>reference</em> to `FcPatternAddFTFace(_FcPattern*, char const*, FT_FaceRec_*)'rn../../staticlib/libthebes.a(gfxPangoFonts.o)(.text+0x25a2):gfxPangoFonts.cpp: <em>undefined</em> <em>reference</em> to `FcFreeTypeCharSet(FT_FaceRec_*, _FcBlanks*)'rn../../staticlib/libthebes.a(gfxFT2Utils.o)(.text+0x7b): In function `gfxFT2LockedFace::GetGlyph(unsigned int)':rngfxFT2Utils.cpp: <em>undefined</em> <em>reference</em> to `FcFreeTypeCharIndex(FT_FaceRec_*, unsigned int)'rncollect2: ld returned 1 exit statusrnmake[3]: *** [libxul.so] Error 1rnmake[3]: Leaving directory `/opt/src/mozilla-1.9.2/toolkit/library'rnmake[2]: *** [libs_tier_toolkit] Error 2rnmake[2]: Leaving directory `/opt/src/mozilla-1.9.2'rnmake[1]: *** [tier_toolkit] Error 2rnmake[1]: Leaving directory `/opt/src/mozilla-1.9.2'rnmake: *** [default] Error 2rn[root@localhost mozilla-1.9.2]#rnrn已经想过很多方法,其中之一在/opt/src/mozilla-1.9.2/toolkit/library/Makefile,rn+EXTRA_DSO_LDOPTS += -lexpat -lfreetype $(FT2_LIBS) rnrn但都不奏效.最好是编译成功提供一下思路.rnrn
调用库的时候,出现undefined reference to
情况是这样的。rn 我现在有一个库,是别人的<em>开发</em>的,编译后生成libpcap_f.a。我用ar -t查看如下:rn[code=c]rn[root@suowenair server]# ar -t libpcap_f.a rnbonree_dump.ornevent.ornhttp_file.ornnetwork_dump.ornport_table.ornssl_file.orntcp_connection.ornthread_mix.orn[/code]rnrn我自己写的另一个程序调用这个库rn但是却出现了rn[code=c]rnserver.o: In function `MsgProc::Proc_e_msg_httpData()':rnserver.cc:(.text+0xa5c): <em>undefined</em> <em>reference</em> to `bonree::EventListenerMaunal::Next()'rnserver.o: In function `MsgProc::CloseAdaptor()':rnserver.cc:(.text+0xf48): <em>undefined</em> <em>reference</em> to `bonree::BonreeDump::Stop()'rnserver.cc:(.text+0xf64): <em>undefined</em> <em>reference</em> to `bonree::BonreeDump::~BonreeDump()'rnserver.o: In function `MsgProc::OpenAdaptor()':rnserver.cc:(.text+0x1174): <em>undefined</em> <em>reference</em> to `bonree::BonreeDump::BonreeDump()'rnserver.cc:(.text+0x11a0): <em>undefined</em> <em>reference</em> to `bonree::EventListenerMaunal::EventListenerMaunal()'rnserver.cc:(.text+0x11fc): <em>undefined</em> <em>reference</em> to `bonree::BonreeDump::RegisterListener(bonree::EventListener*)'rnserver.cc:(.text+0x125c): <em>undefined</em> <em>reference</em> to `bonree::BonreeDump::Start(std::vector, std::allocator >, std::allocator, std::allocator > > > const*)'rn[/code]rnrn我已经引用了该库,但是还是出现这种<em>错误</em>,不理解。我自己<em>开发</em>的程序并且也包含了libpcap_f.a这个库的接口的头文件。
请教:GCC连接时undefined reference to错误
我在test.h头文件中声明fun()函数,并在test.cpp 和 main.cpp中包含test.h头文件rntest.cpp中定义fun()函数rn用CodeBlocks(GCC)编译的<em>时候</em>提示<em>错误</em>:<em>undefined</em> <em>reference</em> to 'fun'rn但是用VC6.0编译的<em>时候</em>可以正确连接rnrn本人新学C++rn请知道的朋友帮忙解释一下rn不胜感激rnrn代码如下:rnrn[code=C/C++]rn// test.hrnrn#ifndef TEST_H_INCLUDEDrn#define TEST_H_INCLUDEDrnrnextern void fun();rnrn#endif // TEST_H_INCLUDEDrnrnrn// test.cpprnrn#include rn#include "test.h"rnrnusing namespace std;rnint a;rnvoid fun()rnrn cout << "fun() called!" << endl;rnrnrnrn// main.cpprnrn#include rn#include "test.h"rnusing namespace std;rnrnint main()rnrn fun();rn return 0;rn[/code]
c++链接过程中undefined reference to 错误的原因
如果一个symbol没有被定义,在编译过程中就会报找不到定义的<em>错误</em> 如果是头文件找不到,也会直接报出头文件不存在的<em>错误</em> 有些<em>时候</em>编译出来的lib被移走了,运行的<em>时候</em>会直接报lib不存在的<em>错误</em>,或者编译的<em>时候</em>报找不到lib 如果链接中出现<em>undefined</em> <em>reference</em> to,有两种可能: 一个是忘记设置某个symbol的lib 自己编译的lib多是因为这个问题,只设置了头文件,没...
undefined reference to 错误 恳请高手指点
小弟写了一个简单排序的算法,linux下用codeblocks编译老报错:"<em>undefined</em> <em>reference</em>"。在windows 用vs2010正常编译运行。想请教一下,到底哪有问题???rnrnmain.cpp文件:rn#include rn#include "simpleSort.h"rnrn#define NUM 100rnrnusing namespace std;rnrnint main()rn int num;rn float a[NUM];rn cout<>num;rn for(int i=0;i>a[i];rn rnrn SSort *sSort = new SSort(a,num);rn sSort->sort();rn sSort->display();rnrnrnsimpleSort.h文件:rn#ifndef SIMPLESORT_H_INCLUDEDrn#define SIMPLESORT_H_INCLUDEDrn#includernrnusing namespace std;rnrnclass SSortrnrn float* a;rn int num;rn public:rn SSort(float x[],int n);rn void sort();rn void display();rn;rn#endif // SIMPLESORT_H_INCLUDEDrnrnrnsimpleSort.cpp文件:rn#include rn#includern#include "simpleSort.h"rnrnusing namespace std;rnSSort::SSort(float x[],int n)rn a=x;rn num=n;rnrnrnvoid SSort::sort()rn int count;rn float min,temp;rn for(int j=0;j
php make 时的错误undefined reference to `gdFreeFontCache'
请指教关于php+gd配置的问题rn在php4.3.7环境下:rn./configure --prefix=/usr/local/php --with-apxs=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-gd=/usr/local/gd-2.0.27rn显示 没有<em>错误</em>,“Thank you for using PHP.”rn而后make,发现有<em>错误</em>:rn/usr/local/php/ext/gd/gd.c:385: <em>undefined</em> <em>reference</em> to `gdFreeFontCache'rncollect2: ld returned 1 exit statusrnmake: *** [sapi/cli/php] Error 1
undefined reference错误,怎么看不懂啊
我编译下面的程序时出现了下面的<em>错误</em>:rnobj\Debug\main.o||In function `main':|rnD:\program_file\temp_file\vac\main.cpp|9|<em>undefined</em> <em>reference</em> to `BaseStationDataBase::initialize()'|rn||=== Build finished: 1 <em>error</em>s, 0 warnings ===|rn但是我怎么都没搞明白,哪位大侠指点一二rn源代码如下:rn[code=c]#include rn#include "BaseStationDataBase.h"rnrnusing namespace std;rnrnint main()rnrn BaseStationDataBase* bsdb = new BaseStationDataBase();rn bsdb->initialize();rn return 0;rnrn[/code]rn[code=c]//BaseStationDataBase.hrn#include rn#include rn#include rn#include rnrnusing namespace std;rnrnstruct sBaseStationrnrn list mobile;rn;rnrnclass BaseStationDataBasernrnpublic:rn BaseStationDataBase();rn ~BaseStationDataBase();rn void initialize();rn int searchMobile(int);rn void update(int);rn void remove(int, int);rn void show();rnprivate:rn sBaseStation _baseStation[400];rn vector _node;rn;rn[/code]rn[code=c]//BaseStationDataBase.cpprn#include "BaseStationDataBase.h"rnrnvoid BaseStationDataBase::initialize()rnrn int numMobile; //the number of mobilern numMobile = 1000;rn int j;rn for (int i = 0; i < numMobile; i++)rn rn j = i % 400; //it can use random() in here for jrn _baseStation[j].mobile.push_back(i);rn rnrnrnvector BaseStationDataBase::searchMobile(int bs)rnrn _node.clear();rn list::iterator it = _baseStation[bs].mobile.begin();rn for (list::iterator it = _baseStation[bs].mobile.begin(); it != _baseStation[bs].mobile.end(); it++)rn rn _node.push_back(*it);rn rn return _node;rnrnrnvoid BaseStationDataBase::show()rnrn for (int i = 0; i < _node.size(); i++)rn cout << _node.at(i);rnrnrnvoid BaseStationDataBase::update(int bs, int phone)rnrn _baseStation[bs].mobile.push_back(phone);rnrnrnvoid BaseStationDataBase::remove(int bs, int phone)rnrn _baseStation[bs].mobile.remove(phone);rnrn[/code]rn
linux下链接出现undefined reference to错误
下边第一条评论是编译时的输出内容,小弟是在是找不到问题出现在那里了,求大神指点下
编译时undefined reference to的错误怎么解决
我下了一个叫做SFML的SDK,在codeblocks里面使用,结果怎么弄都弄不好rnrn给的<em>错误</em>是:rn[img=https://img-bbs.csdn.net/upload/201405/10/1399694387_488068.png][/img]rnrn我是这么设置的rn[img=https://img-bbs.csdn.net/upload/201405/10/1399694476_997555.png][/img]rn[img=https://img-bbs.csdn.net/upload/201405/10/1399694482_714952.png][/img]rn[img=https://img-bbs.csdn.net/upload/201405/10/1399694488_637661.png][/img]rn请问这是怎么回事,我该怎么解决啊,搞了4个多小时,还没有弄好rn求帮助啊
ld出现错误undefined reference to printf
有两个文件:rn[code=C/C++]rnmain.crnvoid main()rn subr(4);rn return 0;rnrn[/code]rnrn[code=C/C++]rnsubr.c rnvoid subr(int i)rn printf("i=%d\n", i);rnrn[/code]rnrn然后敲入命令 gcc -c main.c subr.c, 然后链接ld -o prog main.o subr.o, 结果出现链接<em>错误</em>,<em>undefined</em> <em>reference</em> to printf. 我试着加上-L /src/lib, 但是还是一样的<em>错误</em>。 求各位大牛帮忙解决。rn
关于错误 undefined reference to `spacename::function()`
编译时报错如下:swf 名字空间 stream文件处理类rn<em>undefined</em> <em>reference</em> to `swf::log_msg()` 只要是调用的它的地方都报这个<em>错误</em>rn<em>undefined</em> <em>reference</em> to `swf::stream::read_u16()` 以及stream类中其他函数也都报这个<em>错误</em>rn头文件声明都写了,也都包含进来了,这些都是自己的函数,并非找不到库函数等问题,查了一些网上<em>遇到</em>类似的情况,但一直没得到结果,请高手解答!rn
Qt下WSAStartup()编译报“undefined reference错误
用Qt做一个程序,在windows环境下,我用了如下头文件:rn#ifdef _WIN32rn#include rn#elsern#include rn#endifrn可是编译了对WSAStartup()报<em>错误</em><em>undefined</em> <em>reference</em>,而且连Socket = socket(PF_INET,SOCK_DGRAM,0);这样的函数都报错,请问这是怎么回事啊?
Qt编译动态库调用错误:undefined reference
今天使用Qt写了个动态库,在其他项目文件调用此动态库时,总是报下面<em>错误</em>: 经过和同事研究,终于发现了问题所在: 1.使用Qt编写动态库时,系统自动生成的.h文件里面有个类,如下面所示 class QHKDLLSHARED_EXPORT QHKDLL { public: QHKDLL(); }; 里面包含 QHKDLLSHARED_EXPORT 这个
Kdevelop4错误 main.cpp(text+0x13):undefined reference to .....
下面是三个文件rn1、main.cpprnrn#include rnusing namespace std;rnrn#include "ServerSettings.h"rnrn#define MAX_TEAM_LENGTH 32rnint main(int argc, char **argv) rn rn ServerSettings ss;rn PlayerSettings cs;rn rn char strTeamName[MAX_TEAM_LENGTH]="Qt"; //the teamnamern int iPort = ss.getPort();rn rn rn return 0;rnrnrnrn2、ServerSettings.cpprnrnrnclass ServerSettingsrnrn public:rn ServerSettings();rn int getPort();rn;rnrnrn3、ServerSettings.cpprnrn#include "ServerSettings.h"rnrn#ifndef _SERVERSETTINGS_rn#define _SERVERSETTINGS_rnrnServerSettings::ServerSettings()rnrn rnint ServerSettings::getPort()rnrn return 0;rnrnrn#endifrnrn 在“project”-->"Build all Projets ".出现下面<em>错误</em> ,请高手帮忙。。。。。。。rnrn/home/zhuhaiqing/Qt/Qt/src/build/>makern[100]Build CXX object CMakeFiles/qt.dir/main.cpp.ornlink CXX executable qtrnCMakeFiles/qt.dir/main.cpp.o:In function 'main':rnmain.cpp:(text+0x13):<em>undefined</em> <em>reference</em> to 'ServerSettings::ServerSetting()'rnmain.cpp:(text+0x13):<em>undefined</em> <em>reference</em> to 'ServerSettings::getPort()'rncollect2:ld returened 1 exit statusrnmake[2]:*** [qt]<em>错误</em> 1rnmake[1]:*** [CMakeFiles/qt.dir/all]<em>错误</em> 2rnmake:***[all] <em>错误</em> 2rn***Failed***rnrn希望给出解答方法,我知道<em>错误</em>的原因是函数的实现没有被找到。不知道怎么解决。。。。。。rn40分不少了吧。麻烦大家了
求助:出现undefined reference to的错误,解决不了
Makefile:rnCC = g++rnCPPFLAGS = -m32 -I$(HADOOP_INSTALL)/c++/$(PLATFORM)/includernrnmax_temperature: max_temperature.cpp rn $(CC) $(CPPFLAGS) $< -Wall -L$(HADOOP_INSTALL)/c++/$(PLATFORM)/lib -lhadooppipes \rn -lhadooputils -lpthread -g -O2 -o $@rnrnmax_temperature.cpp:rn#include rn#include rn#include rnrn#include "hadoop/Pipes.hh"rn#include "hadoop/TemplateFactory.hh"rn#include "hadoop/StringUtils.hh"rnrnclass MaxTemperatureMapper : public HadoopPipes::Mapper rnpublic:rn MaxTemperatureMapper(HadoopPipes::TaskContext& context) rn rn void map(HadoopPipes::MapContext& context) rn std::string line = context.getInputValue();rn std::string year = line.substr(15, 4);rn std::string airTemperature = line.substr(87, 5);rn std::string q = line.substr(92, 1);rn if (airTemperature != "+9999" &&rn (q == "0" || q == "1" || q == "4" || q == "5" || q == "9")) rn context.emit(year, airTemperature);rn rn rn;rnrnclass MapTemperatureReducer : public HadoopPipes::Reducer rnpublic:rn MapTemperatureReducer(HadoopPipes::TaskContext& context) rn rn void reduce(HadoopPipes::ReduceContext& context) rn int maxValue = INT_MIN;rn while (context.nextValue()) rn maxValue = std::max(maxValue, HadoopUtils::toInt(context.getInputValue()));rn rn context.emit(context.getInputKey(), HadoopUtils::toString(maxValue));rn rn;rnrnint main(int argc, char *argv[]) rn return HadoopPipes::runTask(HadoopPipes::TemplateFactory2());rnrnrn其中HADOOP_INSTALL=/home/hadoop-0.20.2rn PLATFORM=Linux-i386-32rn且在include和lib文件夹里都已包括对应的头文件和库文件,在Windows vista系统下用cygwin编译后出现下面的提示<em>错误</em>:rn$ makerng++ -m32 -I/home/hadoop-0.20.2/c++/Linux-i386-32/include max_temperature.cpp -Warnll -L/home/hadoop-0.20.2/c++/Linux-i386-32/lib -lhadooppipes \rn -lhadooputils -lpthread -g -O2 -o max_temperaturern/tmp/ccKCPihU.o: In function `_ZNK11HadoopPipes16TemplateFactory2I20MaxTemperaturnreMapper21MapTemperatureReducerE13createReducerERNS_13ReduceContextE':rn/home/hadoop-0.20.2/c++/Linux-i386-32/include/hadoop/TemplateFactory.hh:30: undernfined <em>reference</em> to `HadoopPipes::runTask(HadoopPipes::Factory const&)'rn/home/hadoop-0.20.2/c++/Linux-i386-32/include/hadoop/TemplateFactory.hh:30: undernfined <em>reference</em> to `HadoopUtils::toInt(std::basic_string, std::allocator > const&)'rn/home/hadoop-0.20.2/c++/Linux-i386-32/include/hadoop/TemplateFactory.hh:30: undernfined <em>reference</em> to `HadoopUtils::toString(int)'rncollect2: ld returned 1 exit statusrnmake: *** [max_temperature] Error 1rn
字符串处理string.h错误--undefined reference to `strcopy'
在ubuntu下,字符串处理的中memset,strcmp,strcat等函数都可用,但memcopy,strncopy,strcopy在连接时出现<em>错误</em>错提示如下:rngcc copy.crn/tmp/ccFMUSHS.o: In function `main':rncopy.c:(.text+0x67): <em>undefined</em> <em>reference</em> to `strcopy'rncollect2: ld returned 1 exit statusrnrn源程序很简单如下:rnint main (int argc, char** argv) rn char* p = "abcdefg";rn char a[20] = "\0";rn int i;rn strcopy (a, p);rn printf ("a = %s\n",a);rnrnrn请指点!!!!!!!
Android NDK, 遇到SIGILL错误
我需要在jni代码中使用 semaphore。rnrn直接使用posix的没有问题。rn[code=c]rnvoid* start_routine(void *arg)rnrn sleep(5);rn sem_post(&g_sem);rn pthread_exit(arg);rnrnrnbool test_semaphore()rnrn //main threadrn sem_init(&g_sem, 0, 0);rnrn pthread_t tid = 0;rn int ret;rn ret = pthread_create(&tid, nullptr, start_routine, nullptr);rn if (ret == -1) rn sem_destroy(&g_sem);rn return false;rn rn ret = sem_wait(&g_sem);rn if (ret == -1) rn sem_destroy(&g_sem);rn return false;rn rn sem_destroy(&g_sem);rn return true;rnrn[/code]rnrn这段代码在目标机器上能正确运行,可是当我把 semaphore封装成一个C++类时, 就会出现 SIGILL<em>错误</em>。rn[code=c]rnclass Sema rnpublic:rn Sema(int initVal) rn sem_init(&m_sema, 0, initVal);rn rnrn ~Sema() rn sem_destroy(&m_sema);rn rnrn int Post() rn return sem_post(&m_sema);rn rnrn int Wait() rn return sem_wait(&m_sema);rn rnrnprivate:rn sem_t m_sema;rn;rnrnSema g_sem(0);rnrnrnvoid* start_routine(void *arg)rnrn sleep(5);rn g_sem.Post();rn pthread_exit(arg);rnrnrnbool test_semaphore()rnrn //main threadrnrn pthread_t tid = 0;rn int ret;rn ret = pthread_create(&tid, nullptr, start_routine, nullptr);rn if (ret == -1) rn return false;rn rn ret = g_sem.Wait();rn if (ret == -1) rn return false;rn rn return true;rnrn[/code]rnrn很迷啊!!为什么会这样!!!!!!
ndk编静态库遇到错误
jni/opencv-prefix/jni/include/opencv2/core/types_c.h:55:10: fatal <em>error</em>: ‘assert.h’ file not found解决方案:利用Android Studio内下载重新NDK吧,之前的版本我是直接下载的,可能与AS的Android的SDK有冲突。
undefined reference to "function..."
Redhat 5.0 企业版rnEclipse 3.2 IDErnrn所有写出来的.cpp文件均生成对应.o问件,但总是构建不成功,报错说<em>undefined</em> <em>reference</em> to "function..."。rn去google了,但是很多人给出的都是诸如大小写敏感、路径设置<em>错误</em>、.o文件生成<em>错误</em>,都不能解决问题。rn请高手进来指教!!!!
undefined reference to `lstat'
<em>undefined</em> <em>reference</em> to `lstat'rn这个编译<em>错误</em>说明什么,我用的是mingw,我看glibc里FAQ说是,可能缺少lib.os是这样吗。
图书销售系统下载
图书销售系统 比较简单的系统,可以供给学习者参考 相关下载链接:[url=//download.csdn.net/download/liang2sky/3658355?utm_source=bbsseo]//download.csdn.net/download/liang2sky/3658355?utm_source=bbsseo[/url]
CCNP内部培训资料-互联网简述下载
CCNP的培训资料~只发一章,看大家感觉如何,之后会一章章发出来。 相关下载链接:[url=//download.csdn.net/download/zplxl99/3792531?utm_source=bbsseo]//download.csdn.net/download/zplxl99/3792531?utm_source=bbsseo[/url]
单片机原理与应用及C51程序设计课件第七章__MCS-51与键盘、显示器的接口.ppt下载
单片机原理与应用及C51程序设计课件第七章__MCS-51与键盘、显示器的接口.ppt 相关下载链接:[url=//download.csdn.net/download/feihuachuxing/4555121?utm_source=bbsseo]//download.csdn.net/download/feihuachuxing/4555121?utm_source=bbsseo[/url]
我们是很有底线的