C语言链表undefined reference to 问题

#include
#include
//定义类型
typedef int datatype;
typedef struct node
{
datatype data;
struct node*next;
} linklist;

//函数声明
int most(int*p); //找众数
linklist*create_list(); //生成链表
void put_list(linklist
); //输出链表

int main()
{
linklist*head;
head=create_list();
put_list(head);
}

linklist*create_list(int n) //带头结点的头插法,返回头指针
{
char ch;
printf("输入一组整数,中间用空格隔开,回车结束输入\n");
linklist*head,*p; int number;
head=(linklist*)malloc(sizeof(linklist));
head->next=NULL;
while(scanf("%d",&number))
{
p=(linklist*)malloc(sizeof(linklist));
p->data=number;
p->next=head->next;
head->next=p;
if(getchar()=='\n') break;
}
return head;
}

主函数的第二行 head=create_list();出现错误: undefined reference to `create_list()'
这是为什么呀??

1个回答

1、函数声明与函数不匹配,你声明的函数create_list是无参数列表的,为啥下面函数实现有参数列表?这两个不是一个函数啊
2、主函数里put_list函数传参是个linklist指针,这个和你put_list的声明也不一样

weixin_43328079
七星珠 谢谢,第二个其实是对的,但是复制过来的时候不知道为什么声明里没显示*星号
12 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
c 语言---undefined reference to `socket'的问题
最近在自学c语言,在学网络这章时遇到一个问题:rn代码如下:rn#include rn#include rn#include rn#include rn#include "chinatime.c"rn#define myport 6666rn#define max 100rnint main()rn struct chinatime tc;rn int sockfd;rn struct sockaddr_in myaddr,otheraddr;rn int addr_len,numaddr;rn char buf[max];rn tc=to_china_time(NULL,tc);rn printf("-------------测试程序开始( %s %s %s)------------\n",tc.y_m_d,tc.h_m_s,tc.wday);rn sockfd=socket(AF_INET,SOCK_DGRAM,0);rn getch();rn return 0;rnrnsockfd=socket(AF_INET,SOCK_DGRAM,0);**********这行报错:undefined reference to `socket'rn我在sys文件夹下能找到socket.h,rn并能找到文件中的声明:extern int socket (int __domain, int __type, int __protocol) __THROW;rn不知为什么?请各位多指点.rn
C语言undefined reference to/头文件无法连接
初学C的朋友可能遇到的问题:C命名加载了头文件(.h)却报错,还是无法找到想要的函数/变量。 比如: 在main里进行编译: 明明有的函数却说不存在。 原因很简单,C虽然找到了文件,但是在设置的时候并没有把两个文件关联在一起,故而没有作用。 解决方法: 新建一个项目: 把文件放在项目目录下毫无意义,要把它们添加进项目,即使不在一个目录也无妨。
undefined reference to ... 问题
在写一个内存池,可是在总是出现如题的这个错误rn[code=c]rn#ifndef MEMORYPOOL_Hrn#define MEMORYPOOL_Hrnrn#include rn#include rnrntemplate rnclass MemoryPoolrnrnpublic:rn MemoryPool(int _size = DEFAULTSIZE);rn ~MemoryPool();rn void* alloc(size_t _size);rn void free(void* element, size_t size);rn int size() const rn return _size;rn rn int vaildSize() const rn return _validsize;rn rnprivate:rn enum DEFAULTSIZE = 5;rn /**rn * @brief pool 用来存放内存块的指针rn */rn std::list pool;rn void expandPool(int _len = DEFAULTSIZE);rn int _size;rn int _validsize;rn;rnrntemplate rnMemoryPool::MemoryPool(int _size):rn _size(0),rn _validsize(0)rnrn expandPool(_size);rnrntemplate rnMemoryPool::~MemoryPool()rnrn std::list::iterator ite = pool.begin();rn for (;ite != pool.end();++ite) rn delete[] (*ite);rn rnrntemplate rnvoid* MemoryPool::alloc(size_t /*_size*/)rnrn if (pool.empty()) rn expandPool();rn rn void* t = pool.front();rn pool.pop_front();rn --_validsize;rn return t;rnrntemplate rnvoid MemoryPool::free(void *element, size_t /*size*/)rnrn pool.push_back(element);rn ++_validsize;rnrntemplate rnvoid MemoryPool::expandPool(int _len)rnrn for (int i = 0;i < _len;++i) rn pool.push_back(static_cast(new char[sizeof(T)]));rn rn _validsize += _len;rn _size += _len;rnrnrnrn#endif // MEMORYPOOL_Hrnrn#ifndef TESTOBJ_Hrn#define TESTOBJ_Hrn#include "memorypool.h"rnrnclass Objrnrnpublic:rn Obj() rn static void newPool() rn mPool = new MemoryPool();rn rn static void deletePool() rn delete mPool;rn rn void* operator new(size_t size) rn return mPool->alloc(size);rn rn void operator delete(void* m, size_t size) rn mPool->free(m,size);rn rnrnprivate:rn static MemoryPool *mPool;rn;rnMemoryPool Obj::mPool = NULL;rnrn#endif // TESTOBJ_Hrnrnrn[/code]rnrnrn[img=https://img-bbs.csdn.net/upload/201304/30/1367282753_435259.png][/img]rnrn希望大虾帮解决下
undefined reference to的问题
小弟我入门不久,遇到一个不懂的问题,我写了如下程序,但是编译的时候出现了问题,不知道怎么修正,望各位师傅解答解答rn#include rnvoid printed(int n);rnint main()rn rn int a = 287;rn printed(287);rn getchar();rn return 0;rnrnvoid printd(int n)rnrn if (n < 0) rn rn putchar('-');rn n = -n;rn rn if (n / 10)rn printed(n / 10);rn putchar(n % 10 + '0');rn
问题关于undefined reference to
在linux下,我装了一个新的库,叫Gosu的2d游戏引擎。用CodeBlocks打开一个范例程序,报了很多的undefined reference to错误,程序include了gosu/gosu.hpp这个文件,我去/usr/include文件夹下,找到了gosu这个文件夹,文件夹下的文件也都是齐的。但是我不知道cpp文件都放在什么地方。安装的时候没报错。是什么原因呢?rnrn以前也常有这种问题,不知道是怎么回事。rnrn是不是编译器设置不对?GNU GCC Compiler。
关于undefined reference to 问题
ab.h文件有这么一段定义rnclass Matrix : public GeneralMatrix // usual rectangular matrixrnrn GeneralMatrix* Image() const; // copy of matrixrnpublic:rn Matrix() rn ~Matrix() rn Matrix(int, int); // standard declarationrn Matrix(const BaseMatrix&); // evaluate BaseMatrixrn void operator=(const BaseMatrix&);rn void operator=(Real f) GeneralMatrix::operator=(f); rn void operator=(const Matrix& m) operator=((const BaseMatrix&)m); rn ...rn ...rn;rnrn主函数k.cpp 下面这段代码出错rn Matrix xhat(n,1);rn Matrix phi(n,n);rn Matrix z(m,1);rn错误信息是类似undefined reference to `Matrix::Matrix(int, int)'rn请问如何解决?rn
undefined reference to'CPU_ZERO'问题
我在使用sched_setaffinity将线程和CPU绑定,但总显示“undefined reference to'CPU_ZERO'”。我在文件头已经写了rn#define __USE_GNUrn#include rn为什么出现这些问题,怎样解决?谢谢
undefined reference to 问题
一个简单的建树,打印树的程序。。上眼。。rn[code=C/C++]rn//Tree.h rn 1 #includern 2 using namespace std; rn 10 template < typename T>rn 11 struct nodern 12 //friend class Act;rn 13 T data; rn 14 node< T > *lch;rn 15 node< T > *rch;rn 16 node();rn 17 //node( const T &x );rn 18 ~node();rn 19 ;rn 20 rn 21 template < typename T >rn 22 class Actrn 23 public:rn 24 void Init( node< T >* tr );rn 25 void Print( node< T >* tr );rn 26 ;rnrn//Tree.cpprn 1 #includern 2 #include"Tree.h"rn 3 using namespace std;rn 4 template < typename T >rn 5 void Act< T >::Init( node< T >* tr )rn 6 rn 7 tr = new node< char >;rn 8 cout << "输入data : " << flush;rn 9 cin >> tr -> data;rn 10 if ( tr -> data != "*" )rn 11 rn 12 Init( tr -> lch );rn 13 Init( tr -> rch );rn 14 rn 15 rn 16 template < typename T >rn 17 void Act< T >::Print(node< T >* tr )rn 18 rn 19 if( tr -> data != "*" )rn 20 rn 21 cout << tr -> data << endl;rn 22 Print(tr -> lch ); rn 23 Print(tr -> rch );rn 24 rn 25 rnrn//Main.cpprn 1 #includern 2 #include"Tree.h"rn 3 using namespace std;rn 4 int main()rn 5 rn 6 node< char >* root;rn 7 Act< char > act;rn 8 act.Init( root );rn 9 act.Print( root );rn 10 rn 11 return 0;rn 12 rn[/code]rn报错:rn/tmp/ccP9q7K0.o: In function `main':rn/home/jzh/ProgrammerExcerse/Main.cpp:8: undefined reference to `Act::Init(node*)'rn/home/jzh/ProgrammerExcerse/Main.cpp:9: undefined reference to `Act::Print(node*)'rncollect2: ld 返回 1rnrn不明白阿。。。。。求解
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: undefined reference 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: undefined reference 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: undefined reference 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: undefined reference 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: undefined reference to `syslog'rnrn看样子是是缺少可查了很久rn第一我包含了//这个只有openlog(),closelog()的声明,缺没有定义,rn我不知道到底怎么回事?是不是g++时 没有带什么时候-l参数如果缺少库是缺那个我也不知道,望高手指点rn
undefined reference to `__asan_report_load8'问题
在ubuntu上写c++,gcc和g++版本都是4.8.4。rn编译的时候出现这个提示:rn[code=c]rnrn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_load8'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_store2'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_load4'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_handle_no_return'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_load16'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_init_v1'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6:/home/zhaokt/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_load8'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_store2'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_load4'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_handle_no_return'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_load16'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_init_v1'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_store4'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_load2'rn1> ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6: undefined reference to `__asan_report_store8'rnrn[/code]rn链接命令:rn[code=c]rnrng++ -o "~/workspace/fileservicemanager/fileservicemanager/../bin/x64/Debug/fileservicemanager" -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -ldl -pthread ~/workspace/fileservicemanager/fileservicemanager/obj/x64/Debug/main.o ~/workspace/fileservicemanager/bin/x64/Debug/libnetwork.so ~/workspace/fileservicemanager/bin/x64/Debug/liblog4cplus-1.2.so.5.1.6rnrn[/code]rnrn在网上没找到好的解决方案,不知道该怎么解决。
请教 undefined reference to的问题
我编译成功了libfaad.a,把这个文件和libfaad下面include目录的2个头文件拷贝到ffmpeg下面,./config -enable-libfaad等成功,但是在进入libavcodec目录,并执行make命令时,在生成libfaad.o之后,连接时出现下面的错误:rn/ffmpegwm5/libavcodec/libfaad.c:316: undefined reference to `NeAACDecClose'rn/ffmpegwm5/libavcodec/libfaad.c:316: undefined reference to `NeAACDecOpen'rnrn而这两个函数我都在libfaad.a上能找到符号的,请问各位大虾知不知道怎么回事? 谢谢。
[vxworks undefined reference to 的问题]
各位大大,知道的麻烦说一下,rn往BSP中添加一块dm9000a的网卡,Feidm9KEndLoad,结果rbuild的时候出现下面的错误,不知道是什么原因?rnC:\Tornado2.2\host\x86-win32\bin\makeSymTbl.bat pentium tmp.o symTbl.crnccpentium -c -fdollars-in-identifiers -g -mcpu=pentiumiii -march=p3 -ansi -nostdlib -fno-b rnuiltin -fno-defer-pop -I.. -IC:\Tornado2.2\target\config\SR-3120 -IC:\Tornado2.2\target\h rn-IC:\Tornado2.2\target\config\comps\src -IC:\Tornado2.2\target\src\drv -DCPU=PENTIUM3 -DTO rnOL_FAMILY=gnu -DTOOL=gnu -DPRJ_BUILD -w symTbl.c -o symTbl.ornccpentium -g -mcpu=pentiumiii -march=p3 -ansi -nostdlib -fno-builtin -fno-defer-pop -I.. - rnIC:\Tornado2.2\target\config\SR-3120 -IC:\Tornado2.2\target\h -IC:\Tornado2.2\target\confi rng\comps\src -IC:\Tornado2.2\target\src\drv -DCPU=PENTIUM3 -DTOOL_FAMILY=gnu -DTOOL=gnu -DP rnRJ_BUILD -c C:\Tornado2.2\target\config\comps\src\dataSegPad.crnldpentium -X -N -e sysInit -Ttext 00308000 \rn dataSegPad.o partialImage.o ctdt.o symTbl.o \rn -T C:\Tornado2.2\target\h\tool\gnu\ldscripts\link.RAM -o vxWorksrnpartialImage.o: In function `vgaWriteString':rnf:\work_project\PCI_project\work_spce\proj\SR-3120\default\C:\Tornado2.2\target\src\drv\se rnrial\m6845Vga.c:1068: undefined reference to `Feidm9kEndLoad'rnmake: *** [vxWorks] Error 0x1rnrnDone.
undefined reference to `WinMain@16'问题
程序调用QTest::qwait函数,但编译提示我undefined reference to `WinMain@16'错误问题,头文件QTest.h加了,pro项目文件里添加了CONFIG += qtestlib,但还是提示上面的错误。
undefined reference to问题!!!
main.c:(.text+0x7): undefined reference to `test' rncollect2: ld returned 1 exit status rnrntest是在mainwindow.h中定义的全局变量,然后在main.cpp和mainwindow.cpp中使用时出现这个问题,求助
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编译器报错:rnundefined reference to "Open_listenfd"rnundefined reference to "Gethostbyaddr"rnundefined reference to "Close"rnrnundefined reference to "Rio_readinitb"rnundefined reference to "Rio_writen"rnundefined reference to "Rio_readlineb"rnrnrn头文件 csapp.h我是从教材的官网上下载的rn我也看过了, 上面这些“undefined”的函数, 在头文件里面也有。rnrn不明白为什么编译器报错, 望指教!rnrn谢谢!
(菜鸟飞飞)undefined reference的问题
程序:rn[code=C/C++]rn#include rn#include rn#include rn#include rn#include rn#include rn#include rn#define BUFFER_MAX 2048rnrnint main(int argc, char *argv[])rnrn rn int sock, n_read, proto; rn char buffer[BUFFER_MAX];rn char *ethhead, *iphead, *tcphead, rn *udphead, *icmphead, *p;rn rnif((sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_IP))) < 0)rn rn fprintf(stdout, "create socket error\n");rn exit(0);rn rn rnwhile(1) rnrn n_read = recvfrom(sock, buffer, 2048, 0, NULL, NULL);rn /*rn 14 6(dest)+6(source)+2(type or length)rn +rn 20 ip header rn +rn 8 icmp,tcp or udp headerrn = 42rn */rnif(n_read < 42) rn rn fprintf(stdout, "Incomplete header, packet corrupt\n");rn continue;rn rn rn ethhead = buffer;rn p = ethhead;rn int n = 0XFF;rn printf("MAC: %.2X:%02X:%02X:%02X:%02X:%02X==>"rn "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n",rn p[6]&n, p[7]&n, p[8]&n, p[9]&n, p[10]&n, p[11]&n,rn p[0]&n, p[1]&n, p[2]&n,p[3]&n, p[4]&n, p[5]&n);rnrn iphead = ethhead + 14; rn p = iphead + 12;rn rn printf("IP: %d.%d.%d.%d => %d.%d.%d.%d\n",rn p[0]&0XFF, p[1]&0XFF, p[2]&0XFF, p[3]&0XFF,rn p[4]&0XFF, p[5]&0XFF, p[6]&0XFF, p[7]&0XFF);rn proto = (iphead + 9)[0];rn p = iphead + 20;rn printf("Protocol: ");rn switch(proto)rn rn case IPPROTO_ICMP: printf("ICMP\n");break;rn case IPPROTO_IGMP: printf("IGMP\n");break;rn case IPPROTO_IPIP: printf("IPIP\n");break;rn case IPPROTO_TCP :rn case IPPROTO_UDP : rn printf("%s,", proto == IPPROTO_TCP ? "TCP": "UDP"); rn printf("source port: %u,",(p[0]<<8)&0XFF00 | p[1]&0XFF);rn printf("dest port: %u\n", (p[2]<<8)&0XFF00 | p[3]&0XFF);rn break;rn case IPPROTO_RAW : printf("RAW\n");break;rn default:printf("Unkown, please query in include/linux/in.h\n");rn rn rnrn[/code]rnrn网上的一个抓取链路层的原始 socket程序,然后在linux下执行:rn[root@localhost C]# gcc -c SimpelSniffer.c -o SimpelSnifferrn[root@localhost C]# chmod 755 SimpelSnifferrn[root@localhost C]# ./SimpelSnifferrn-bash: ./SimpelSniffer: cannot execute binary filern[root@localhost C]# ld ./SimpelSnifferrnld: warning: cannot find entry symbol _start; defaulting to 0000000008048074rn./SimpelSniffer: In function `main':rnSimpelSniffer.c:(.text+0x1f): undefined reference to `htons'rnSimpelSniffer.c:(.text+0x37): undefined reference to `socket'rnSimpelSniffer.c:(.text+0x45): undefined reference to `stdout'rnSimpelSniffer.c:(.text+0x65): undefined reference to `fwrite'rnSimpelSniffer.c:(.text+0x71): undefined reference to `exit'rnSimpelSniffer.c:(.text+0xa6): undefined reference to `recvfrom'rnSimpelSniffer.c:(.text+0xb4): undefined reference to `stdout'rnSimpelSniffer.c:(.text+0xd4): undefined reference to `fwrite'rnSimpelSniffer.c:(.text+0x273): undefined reference to `printf'rnSimpelSniffer.c:(.text+0x344): undefined reference to `printf'rnSimpelSniffer.c:(.text+0x368): undefined reference to `printf'rnSimpelSniffer.c:(.text+0x3cd): undefined reference to `puts'rnSimpelSniffer.c:(.text+0x3de): undefined reference to `puts'rnSimpelSniffer.c:(.text+0x3ef): undefined reference to `puts'rnSimpelSniffer.c:(.text+0x426): undefined reference to `printf'rnSimpelSniffer.c:(.text+0x45d): undefined reference to `printf'rnSimpelSniffer.c:(.text+0x497): undefined reference to `printf'rnSimpelSniffer.c:(.text+0x4a8): undefined reference to `puts'rnSimpelSniffer.c:(.text+0x4b9): undefined reference to `puts'rn[root@localhost C]#rnrn却报了这么多错误。为题在哪里呢?谢谢大牛们了!!
[Linker error] undefined reference to `*::*' 的问题
有两个比较大的类rn然后就提示链接错误rnrn[Linker error] undefined reference to `*::*'rnrn其中的*号是类名和构造函数,错误的地方在主函数。rn构造函数有声明没定义。而且这两个类的头文件都被包含进来的。rn实在找不出问题出在哪里了?rn高人,高人,在哪里?
*****SOS***undefined reference to `__ctype_b' 问题********
在编译sybase 的example时出现的In function `db__crs_search_phrase':rn: undefined reference to `__ctype_tolower'rnrn执行makefile后rncc -I. -I/home/sybase/OCS-12_5/include -L/home/sybase/OCS-12_5/lib -L/usr/lib example1.c /home/sybase/OCS-12_5/lib/libsybdb.a /home/sybase/OCS-12_5/lib/libsybtcl.a /home/sybase/OCS-12_5/lib/libintl.a -lm -o example1rnrn我的linux 是fc3 版本,有人说是glibc的版本问题,但不知怎么解决。rn
链接 过程中 的 undefined reference to 问题
链接中的undefined reference to问题: rnrn用 gcc 链接 链接语句: gcc main.o -o main -L/home/lh/cnooc/lib -lall -lxsrc rnrn错误: rn在 /home/yc/lh/lib/libxsrc.a(其中 apexec.o 在 libxsrc.a 库中 ): In function `apexec': rn中出现错误: rn/home/yc/lh/xsrc/apexec.c:62: undefined reference to `gettxta' rn就是说我的 apexec.c 中没有 定义 gettxta 函数 rn但是 这个函数 在 liball.a 库里 已经包含了, 为什么还会出现这个错误 ! rnrn希望说清楚了,各位有什么建议或解决办法 ?
"undefined reference to"问题,求帮助!!!!!!~~~
问题一:rn[code=c]rn#include "mainwindow.h"rn#include "ui_mainwindow.h"rn#include rn#include rnrnMainWindow::MainWindow(QWidget *parent) :rn QMainWindow(parent),rn ui(new Ui::MainWindow)rnrn ui->setupUi(this);rnrnrnMainWindow::~MainWindow()rnrn delete ui;rnrnrnvoid MainWindow::on_pushButton_clicked()rnrn mysound = new QSound("houlai.wav");rn mysound->play();rn[/code]rnrnerror::../test/mainwindow.cpp:21: error: undefined reference to `QSound::QSound(QString const&, QObject*)'rnerror::../test/mainwindow.cpp:22: error: undefined reference to `QSound::play()'rn[color=#FF0000]这个错误是怎么回事啊,头文件也添加了啊,要疯了。。。。[/color]rnrn问题二:rn[color=#FF0000]本来是想做个声卡编程的应用程序,下载了ALSA驱动,也apt-get install liasound2-dev,rn头文件#include rn#include rn#include 也添加了,并且我ctrl 点击头文件也能找到rn可是也是rnerrro:../playertest2/playsound.cpp:66: error: undefined reference to `snd_pcm_open' (注:snd_pcm_open是中函数)rn这是我什么东西没有设置的事么??[/color]rn开发环境:rn新装的Ubuntu 12.04 ,Qt5.2.1,qtcreat 3.0rnrn问题三:rn这么在编辑器中输入中文啊。。。rnrn在线跪等啊。。。。。。。。。。。。T_T~~~~~~~~~~~~~rnrn
关于Qt的问题 undefined reference to
问题是这样的:我用类QSvgRenderer 写了一个小程序,结果报错 rnD:\programing\svg/svgwidget.cpp:3: undefined reference to `_imp___ZN10QSvgWidgetC2EP7QWidget'rnD:\programing\svg/svgwidget.cpp:5: undefined reference to `_imp___ZNK10QSvgWidget8rendererEv'rnD:\programing\svg/svgwidget.cpp:6: undefined reference to `_imp___ZN10QSvgWidgetD2Ev'rnD:\programing\svg/svgwidget.cpp:3: undefined reference to `_imp___ZN10QSvgWidgetC2EP7QWidget'rnD:\programing\svg/svgwidget.cpp:5: undefined reference to `_imp___ZNK10QSvgWidget8rendererEv'rnD:\programing\svg/svgwidget.cpp:6: undefined reference to `_imp___ZN10QSvgWidgetD2Ev'rn....rn应该是一些库没链接上?具体应该怎么办呢?rn有一点线索rn在预处理命令里,我用#include 是不行的rn必须用#include rn求大神指点
很烦人的问题:undefined reference to??
哪位兄弟告诉我rnundefined reference to 'itoa' 要 -l什么库?rnrn哪位帮忙帖一些常用的库来解决这些问题。
gcc编译问题请教。。。undefined reference to
一个system C(其实就是CPP的一个扩展)程序。编译rnrngcc -c没有问题 但是gcc -o 就不行了报错如下,谁给看看,谢谢。rnrnrn/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':rn/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'rn/tmp/ccZKFTjj.o: In function `sc_main':rn/tmp/ccZKFTjj.o(.text+0x5b): undefined reference to `sc_module_name::sc_module_name(char const *)'rn/tmp/ccZKFTjj.o(.text+0x8d): undefined reference to `sc_module_name::sc_module_name(char const *)'rn/tmp/ccZKFTjj.o(.text+0xbf): undefined reference to `sc_module_name::sc_module_name(char const *)'rn/tmp/ccZKFTjj.o(.text+0x15b): undefined reference to `sc_module::operator<<(sc_interface &)'rn/tmp/ccZKFTjj.o(.text+0x166): undefined reference to `sc_module::operator<<(sc_interface &)'rn/tmp/ccZKFTjj.o(.text+0x19c): undefined reference to `sc_module::operator<<(sc_interface &)'rn/tmp/ccZKFTjj.o(.text+0x1a7): undefined reference to `sc_module::operator<<(sc_interface &)'rn/tmp/ccZKFTjj.o(.text+0x1b2): undefined reference to `sc_module::operator<<(sc_interface &)'rn/tmp/ccZKFTjj.o(.data+0x0): undefined reference to `sc_interface type_info node'rn/tmp/ccZKFTjj.o: In function `sc_port_b >::add_interface(sc_interface *)'rnrnrn:。。。。。。。。。。。。。。。。。rnrnrnrn/tmp/ccZKFTjj.o(.sc_pvector_base::gnu.linkonce.t.push_back(void *)+0x24): undefined reference to `sc_pvector_base::resize(int)'rncollect2: ld returned 1 exit status
请教一个undefined reference to的问题
有一个程序P,它是由a.so, b.so和一些.cc, .h文件生成的。其中a.so与b.so的类互有引rn用。一开始编译正常。当我在生成a.so的文件里加了一些函数,这些函数引用了b.so的源rn文件。再次编译就出现了undefined reference to的错误,未定义的引用都是我在a.so里rn新加入的b.so里的函数。由于我初学linux下的c++编程,没有相关的经验。希望各位能给rn我说一下可能导致这种情况的原因。我在网上查到的方法都没办法解决。谢谢!
编译问题 undefined reference to `mysql_free_result'
编译命令:rnc++ -Wall -g -D_GNU_SOURCE -lresolv -lpthread -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient -lnsl libmudos.a -o esiirnrn/usr/include/mysql 和 /usr/lib/mysql目录下有头文件和库文件rnrn但是编译始终出现如下错误信息:rn/home/cntop/ccmud_liunx/setup_npc/../npc/wiz/wiz_hanshueiyu.h:383: undefined reference to `CRoom::remove_doors(char const *)'rn/home/cntop/ccmud_liunx/setup_npc/../npc/wiz/wiz_hanshueiyu.h:383: undefined reference to `mysql_real_query'rnrn查资料是连接错误,但是不知道怎么解决,请教大家。
undefined reference to 这个编译出错问题
在工程中已经把该函数的声明和定义以及该函数的调用都注释掉了,但用cmake编译还是会出现该编译问题;rnrn
C语言的链表问题
C语言的链表问题,怎么学它和运用它!
c语言链表问题
u->right=u->op1+u->op2;rn 求高人解释一下什么意思,
C语言链表问题
//求大神帮忙看看,一到删除第j个结点元素就运行错误rn/*要求:rn1、创建一个带头结点的单链表(头指针为head),且遍历此链表(输出链表中各结点的值);rn 2、查找单链表中的第i个结点,并输出结点元素的值;rn 3、在单链表中的第i个结点前插入一个结点值为e的正整数(从外部输入);rn 4、删除单链表中的第j个结点;rn *5、将单链表中的各结点就地逆序(不允许另建一个链表);*/rn#includern#includern#includerntypedef struct LNodernrn int data;rn struct LNode *next;rnLNode,*Linklist;rnvoid Creatlist(Linklist head,int n);rnvoid Traverselist(Linklist head);rnvoid del(Linklist head,int j);rnvoid rev(Linklist head,int n);rnvoid search(Linklist head,int i);rnvoid Insert(Linklist head,int i,int e);rnint main()rnrn int n,i,e,j;rn Linklist head;rn head=(Linklist)malloc(sizeof(LNode));rn if(head==NULL)rn exit(1);rn Creatlist(head,n);rn printf("遍历链表,输出链表:\n");rn Traverselist(head);rn search(head,i);rn Insert(head,i,e);rn printf("插入后的链表为:\n");rn Traverselist(head);rn del(head,j);rn printf("删除后的链表为:\n");rn Traverselist(head);rn rev(head,n);rn printf("逆序后的链表为:\n");rn Traverselist(head);rn getchar();rn return 0;rnrnvoid Creatlist(Linklist head,int n)rnrn int i;rn head->next=NULL;rn Linklist p,q;rn q=head;rn p=(Linklist)malloc(sizeof(LNode));rn if(p==NULL)rn exit(1);rn printf("请输入结点个数n的值:");rn scanf("%d",&n);rn printf("请输入各个结点的值:");rn for(i=0;idata);rn p->next=NULL;rn q->next=p;rn q=p;rn rnrnvoid Traverselist(Linklist head)rnrn Linklist p;rn p=head->next;rn while(p!=NULL)rn rn printf("%3d",p->data);rn p=p->next;rn rnrnvoid search(Linklist head,int i)rnrn printf("\n请输入查找第i个结点的i的值:");rn scanf("%d",&i);rn Linklist p;rn p=head;rn int j=1;rn while((p->next)&&(j<=i))rn rn p=p->next;rn j++;rn rn printf("%d",p->data);rnrnvoid Insert(Linklist head,int i,int e)rnrn printf("\n在第i个结点前插入一个整数e,请分别输入i和e的值:");rn scanf("%d%d",&i,&e);rn Linklist p,q;rn p=head;rn int j=1;rn while((p->next)&&(jnext;rn j++;rn rn if(!p||j>i)rn printf("插入位置错误");rn q=(Linklist)malloc(sizeof(LNode));rn q->data=e;rn q->next=p->next;rn p->next=q;rnrnvoid del(Linklist head,int j)rnrn Linklist p,q;rn p=head;rn int i=1;rn printf("\n请输入要删除的第j个元素j的值:");rn scanf("%d",&j);rn while((p->next)&&(inext;rn i++;rn rn if(!p||jnext;rn p->next=q->next;rn free(q);rnrn/*void del(Linklist head)rnrn int j,i=0;rn printf("\n输入j的值:\n");rn scanf("%d",&j);rn Linklist p,q;rn p=head;rn q=head;rn for(i=1;i<=j;i++)rn p=p->next;rn if(p==NULL)rn exit(0);rn for(i=1;inext;rn q->next=p->next;rn p->next=NULL;rn free(p);rn printf("当前序列为:\n");rn q=head->next;rn while(q)rn rn printf("%d\t",q->data);rn q=q->next;rn rn printf("\n");rn*/rnvoid rev(Linklist head,int n)rn rn Linklist p, q, r; rn if(head==NULL) rn return; rn p=head->next; rn q=p->next; //q为p下一个节点 rn while(q) rn rn r=q->next; //r为q下一个节点 rn q->next=p; //指针回指 rn p=q; rn q=r; //p, q后移 *关键是对指针间赋值的理解* rn rn head->next=p; rn rn
C语言链表问题...
#include rn#include rn#includernrnstruct studentrnrn long num;rn char name[20];rn char sex[10];rn char year[200];rn struct student *next;rn;rnrnrnstruct student *create()rnrn struct student *head, *p1, *p2;rn int i, len;rnrn head=NULL;rn len=sizeof(struct student);rn for(i=0; i<5; i++)rn rn p1=(struct student *)malloc(len);rn scanf("%ld %s %s %s",&p1->num, p1->name,p1->sex,p1->year);rn if(i==0) head=p2=p1;rn elsern rn p2->next=p1;rn p2=p1;rn rn if(i==4) p2->next=NULL;rn rn return head;rnrnrnrnvoid display(struct student *head)rnrn struct student *p1;rnrn p1=head;rn while(p1!=NULL)rn rn printf("%ld\n%s\n%s\n%s\n",p1->num,p1->name,p1->sex,p1->year);rn p1=p1->next;rn rnrnrnrnint Delete(struct student **head,char a[200])rnrn struct student *p1, *p2;rnrn p1=p2=*head;rn while(p1!=NULL)rn rn if (strcmp(p1->year,a)==0)rn rn if (p1==*head)rn *head=p1->next;rn elsern p2->next=p1->next;rn free(p1);rn return 1;rn rnrn p2=p1;rn p1=p1->next;rn rn return 0;rnrnrnvoid insert(struct student *head,char a[200])rnrn struct student *p1,*q;rn q=(struct student *)malloc(sizeof(struct student));rn strcpy(q->name,"aaa");rn strcpy(q->sex,"male");rn strcpy(q->year,a);rn p1=head;rn while(p1->next!=NULL)rn rn p1=p1->next;rn rn p1->next=q;rn q->next=NULL;rnrnint main( )rnrn struct student *head;rn char a[200];rnrn head=create();rn scanf("%s",a);rn Delete(&head,a);rn if (Delete(&head,a)!=1)rn insert(head,a);rn display(head);rn return 0;rnrnrn题目如下:rn描述: 建立一个链表,每个节点包括学生的学号、姓名、性别、年龄。先输入5个学生的数据,再输入一个年龄,如果链表中有年龄等于此年龄的记录,则删除所有年龄等于此年龄的记录,否则在链表的最后增加一个新节点,学号为180姓名为"aaa",性别为"male"。rn rn输入: 创建链表时输入5个职工的职工号和工资,学号为大于100且小于200的整数,姓名为长度小于20的字符串,性别为长度小于10的字符串,年龄为大于等于0且小于200的整数。rn rn输出: 按顺序输出链表中的所有数据,每个数字占一行。 rn输入样例: 107 maliu male 28rn109 niuqi female 22rn101 zhangsan male 30rn103 lisi female 18rn105 wangwu male 25rn28 rn输出样例: 109rnniuqirnfemalern22rn101rnzhangsanrnmalern30rn103rnlisirnfemalern18rn105rnwangwurnmalern25rnrnrn但我的输出后面多了 180; aaa; male; 28;rn求教各位!!!!!!!!!
C语言链表问题....................
#includen#includenstruct studentnchar name[20];nint score;nstruct student *next;n;ntypedef struct student STU;nvoid print(STU *tail,STU *p_cur);nSTU display(STU *p_cur);nvoid pfree(STU *tmp,STU *head);nint main()nnSTU *head,*tail,*p_cur,*tmp;nint i;ni=0;nhead=(STU*)malloc(sizeof(STU));nprintf("please input the name");nscanf("%s",head->name);nprintf("please input the score");nscanf("%d",&head->score);nhead->next=NULL;nhead->next=p_cur;np_cur=head;nfor(i=0;i<2;i++)nn print(tail,p_cur);nnprintf("display");np_cur=head;ndisplay(p_cur);npfree(tmp,head);nreturn 0;nnvoid print(STU *tail,STU *p_cur)nntail=(STU*)malloc(sizeof(STU));nprintf("please input the name");nscanf("%s",tail->name);nprintf("please input the score");nscanf("%d",&tail->score);ntail->next=NULL;np_cur->next=tail;ntail=p_cur;nnSTU display(STU *p_cur)nnfor(p_cur!=NULL)nnprintf("the name: %s,the score : %d",p_cur->name,p_cur->score);np_cur=p_cur->next;nnreturn *p_cur;nnvoid pfree(STU *tmp,STU *head)nnwhile(head->next!=NULL)nntmp=head->next;nhead->next=tmp->next;nfree(tmp);nnfree(head);nn这个程序有毛病求解答
C语言链表的问题
简单的生成链表的代码:rn[code=c]rn#include rn#include rnrnstruct Studentrnrn int id;rn char *name;rn char sex;rn int age;rn;rnstruct StudentListrnrn struct Student *student;rn struct StudentList *next;rn;rnstruct Student makeStudent(int id,char *name,char sex,int age)rnrn struct Student student;rn student.id=id;rn student.name=name;rn student.sex=sex;rn student.age=age;rn return student;rnrnstruct StudentList * addList(struct Student *student,struct StudentList *head)rnrn struct StudentList sl;rn sl.student=student;rn sl.next=head;rn head=&sl;rn return head;rnrnvoid show(struct StudentList *head)rnrn struct Student *sp;rn while(head!=NULL)rn rn sp=head->student;rn if(sp!=NULL)rn rn printf("ID:%d\tName:%s\tSex:%c\tAge:%d\n",sp->id,sp->name,sp->sex,sp->age);rn rn head=head->next;rn rnrnint main()rnrn struct Student sd=makeStudent(1,"Tom",'F',20);rn struct Student sd1=makeStudent(2,"Tony",'M',22);rn struct StudentList *head=NULL;rn head=addList(&sd,head);rn head=addList(&sd1,head);rn printf("%s\n",head->student->name); //1rn printf("%s\n",head->student->name); //2rn // show(head);rn return 0;rnrn[/code]rnrn上面addList函数添加节点,show函数遍历链表。现在问题是main函数里单独执行注释1或2的printf能产生结果,两个一起执行就只能正常输出一次,第二次不输出,产生错误的返回值。这是为什么呢?rn还有如果两个printf都不执行,只执行一个printf("%s\n",head->next->student->name); 结果显示的却是Tony,不应该是Tom的吗?rnshow函数就更不用说了,一样只能产生一个值,如果前面有printf语句,就一个值也没有。rn是链表生成的函数写得不对吗?就是找不出问题来,求大神帮忙看一下。
c语言,链表问题
main函数主题rn#include "stdafx.h"rn#include rn#include rntypedef char ElemType;rntypedef struct LNode //定义单链表结点类型rnrnElemType data;rnstruct LNode *next;rn LinkList;rnextern void InitList(LinkList *&L);rnextern void DestroyList(LinkList *&L);rnextern int ListEmpty(LinkList *L);rnextern int ListLength(LinkList *L);rnextern void DispList(LinkList *L);rnextern int GetElem(LinkList *L,int i,ElemType &e);rnextern int LocateElem(LinkList *L,ElemType e);rnextern int ListInsert(LinkList *&L,int i,ElemType e);rnextern int ListDelete(LinkList *&L,int i,ElemType &e);rnint _tmain(int argc, _TCHAR* argv[])rnrnLinkList *h;rnElemType e;rnprintf("(1)初始化单链表h\n");rnInitList(h);rn[color=#FF0000]printf("(2)依次采用尾插法插入a,b,c,d,e元素\n");rnListInsert(h,1,'a');rnListInsert(h,2,'b');rnListInsert(h,3,'c');rnListInsert(h,4,'d');rnListInsert(h,5,'e');[/color]rnprintf("(3)输出单链表h:");rnDispList(h);rnprintf("(4)单链表h长度=%d\n",ListLength(h));rnprintf("(5)单链表h为%s\n",(ListEmpty(h)?"空":"非空"));rnGetElem(h,3,e);rnprintf("(6)单链表h的第3个元素=%c\n",e);rnprintf("(7)元素a的位置=%d\n",LocateElem(h,'a'));rnprintf("(8)在第4个元素位置上插入f元素\n");rnListInsert(h,4,'f');rnprintf("(9)输出单链表h:");rnDispList(h);rnprintf("(10)删除h的第3个元素\n");rnListDelete(h,3,e);rnprintf("(11)输出单链表h:");rnDispList(h);rnprintf("(12)释放单链表h\n");rnDestroyList(h);rnrnrn请问怎么把上面红色的代码改成由使用者输入链表元素个数,输入各个元素的DATA后再生成相应的链表rn~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~rn函数实现如下rn#include rn#include rntypedef char ElemType;rntypedef struct LNode //定义单链表结点类型rnrnElemType data;rnstruct LNode *next;rn LinkList;rnvoid InitList(LinkList *&L)rnrnL=(LinkList *)malloc(sizeof(LinkList)); //创建头结点rnL->next=NULL;rnrnvoid DestroyList(LinkList *&L)rnrnLinkList *p=L,*q=p->next;rnwhile (q!=NULL)rnrnfree(p);rnp=q;rnq=p->next;rnrnfree(p);rnrnint ListEmpty(LinkList *L)rnrnreturn(L->next==NULL);rnrnint ListLength(LinkList *L)rnrnLinkList *p=L;int i=0;rnwhile (p->next!=NULL)rnrni++;rnp=p->next;rnrnreturn(i);rnrnvoid DispList(LinkList *L)rnrnLinkList *p=L->next;rnwhile (p!=NULL)rnrnprintf("%c",p->data);rnp=p->next;rnrnprintf("\n");rnrnint GetElem(LinkList *L,int i,ElemType &e)rnrnint j=0;rnLinkList *p=L;rnwhile (jnext;rnrnif (p==NULL)rnreturn 0;rnelsernrne=p->data;rnreturn 1;rnrnrnint LocateElem(LinkList *L,ElemType e)rnrnLinkList *p=L->next;rnint n=1;rnwhile (p!=NULL && p->data!=e)rnrnp=p->next;rnn++;rnrnif (p==NULL)rnreturn(0);rnelsernreturn(n);rnrnint ListInsert(LinkList *&L,int i,ElemType e)rnrnint j=0;rnLinkList *p=L,*s;rnwhile (jnext;rnrnif (p==NULL) //未找到第i-1个结点rnreturn 0;rnelse //找到第i-1个结点*prnrns=(LinkList *)malloc(sizeof(LinkList)); //创建新结点*srns->data=e; rns->next=p->next; //将*s插入到*p之后rnp->next=s;rnreturn 1;rnrnrnint ListDelete(LinkList *&L,int i,ElemType &e)rnrnint j=0;rnLinkList *p=L,*q;rnwhile (jnext;rnrnif (p==NULL) //未找到第i-1个结点rnreturn 0;rnelse //找到第i-1个结点*prnrnq=p->next; //q指向要删除的结点rnif (q==NULL) return 0;rne=q->data;rnp->next=q->next; //从单链表中删除*q结点rnfree(q); //释放*q结点rnreturn 1;rnrnrn
严重的问题 undefined reference to `mysql_create_db'
LINUX下 php-4.4.0 ,mysql4.1.8 ,apache_1.3.33 , 在对 php-4.4.0 安装的时候 make rn出现错误 ,找了大半天 没有找到答案 ;有人说是 MYSQL太高 ,可是我不能换低于4.1版本的rn数据库;怎么办 ?rnrn/zend_strtod.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lmysqlclient -lz -lresolv -lm -ldl -lnsl -lcrypt -lcrypt -o sapi/cli/phprnext/mysql/php_mysql.o(.text+0x2116): In function `zif_mysql_create_db':rn/usr/local/php-4.4.0/ext/mysql/php_mysql.c:1163: undefined reference to `mysql_create_db'rnext/mysql/php_mysql.o(.text+0x2331): In function `zif_mysql_drop_db':rn/usr/local/php-4.4.0/ext/mysql/php_mysql.c:1205: undefined reference to `mysql_drop_db'rncollect2: ld returned 1 exit statusrnmake: *** [sapi/cli/php] Error 1rnrnrn
g++编译链接c语言文件报错“undefined reference ” 的处理
用QT写一界面程序,其中用到另一同事写的一个小功能,他是用c语言写的,于是把他的代码头文件和源文件都copy过来了,加入工程中,结果链接的时候就总报错 undefined reference 某个函数。再三确认了makefile文件和源码,表示没问题,后来想到或许是g++和gcc是不是编译后不一样啊,再上网一查,果然,g++编译的.o文件C语言好像无法识别(大概是这个意思,具体是怎样的也没细研究)...
c 语言链表建立 c语言链表
c 语言链表建立c 语言链表建立c 语言链表建立c 语言链表建立
求教undefined reference to
用g++编译一下代码时出现这样的问题:rn undefined reference to `Tree::Tree()'rnrn 1 #include rn 2 #include rn 3 using namespace std;rn 4rn 5 template rn 6 struct CSTnodern 7 rn 8 T data;rn 9 struct CSTnode* firstchild;rn 10 struct CSTnode* nextsibling;rn 11 struct CSTnode* parent;rn 12 ;rn 13rn 14 template rn 15 class Treern 16 rn 17 public:rn 18 Tree();rn 19 virtual ~Tree();rn 20 virtual void getParent() const=0;rn 21 virtual void getFirstChild() const=0;rn 22rn 23 ;rn 24rn 25 template rn 26 class csTree: public Treern 27 rn 28 public:rn 29 csTree();rn 30 ~csTree();rn 31 void getParent() const;rn 32 void getFirstChild() const;rn 33rn 34 private:rn 35 struct CSTnode* root;rn 36 ;rn 37rn 38 template rn 39 csTree::csTree():Tree()rn 40 rn 41 root=new CSTnode;rn 42 root->firstchild=NULL;rn 43 root->nextsibling=NULL;rn 44 rn 45rn 46 template rn 47 csTree::~csTree()rn 48 rn 49 rn 50 template rn 51 void csTree::getParent() constrn 52 rn 53 cout<<""<rn 56 void csTree::getFirstChild() constrn 57 rn 58 cout<<""< cs;rn 66 return 1;rn 67 rn
undefined reference to `CRYPTO_malloc_init'
本人在linux系统安装apache时configure这步没问题:rn./configure --prefix=/usr/local/apache --enable-ssl --enable-rewrite --enable-so --with-ssl=/usr/local/opensslrn 但是make时遇到报错rnhttpd-2.4.20/support/ab.c:2380: undefined reference to `CRYPTO_malloc_init'rnrn请问各位大神如何解决?
编译报错 undefined reference
一个叫 Component 的classrnrn[code=C/C++]//情况1,没有Component.cpp,光有一个Component.h,构造函数定义在其中rnclass Component rnpublic:rn Component() rn...rn;[/code]rn这样就会报rn[color=#FF0000]undefined reference to `Component::Component()'[/color]rnrn如果改成这样就okrn[code=C/C++]//情况2,同时又Component.cpp和Component.h,构造函数定义在cpp中rnrn//file Component.hrnclass Component rnpublic:rn Component();rn...rn;rnrn//file Component.cpprn#include "Component.h"rnComponent::Component() rnrn[/code]rnrnrn如果同时在h和cpp里都定义构造函数,又会出现重复定义的错误rn[color=#FF0000]redefinition of 'Component::Component()'[/color]rn[code=C/C++]//情况3,同时在cpp和h中定义构造函数rnrn//file Component.hrnclass Component rnpublic:rn Component() rn...rn;rnrn//file Component.cpprn#include "Component.h"rnComponent::Component() rnrn[/code]rnrn请问为什么情况1会报错?就是只在.h里定义构造函数。rn
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制