个人blog域名http://www.cdusoft.com,欢迎大家来访
有时候在编译C++代码的时候我们经常会遇到一些奇怪的,灵异的错误,也许这就是我遇到的最离奇的错误吧,下面和大家一起分享一下
有一天自己在编译c语言课设的错误~编译时报[Linker error] undefined reference to 'Insert_a_Record(stud *)错误,改得我郁闷了~
以前没遇到过这样的错误,在网上得知undefined reference表示没有连接在库~我就郁闷了,一个简单的课设,自己定义的一个函数怎么会要求连接到什么库呢?花了我大概一个小时才发现为什么会有这样的错误。比如我们写一个C程序:
#include <stdio.h>
int change(int a, int b);
int main(int argc, char *argv[])
{
int a, b;
change(a, b);
}
这个时候编译就会报这样的错误。原因在于我们在程序中声明了change这个函数。可是却没有在程序中实现这个函数。而编译时人认为我们在其它源文件或库中实现了这一函数,而包含的头文件中却没有任何地方实现这一函数,所以就报错:没有连接到库。通俗一点说,就好像我们给某个人说我的书包里有一张什么样的纸,但这个人去找的时候却没有找到,他就回来告诉我们说没有找到这张纸。
这里,某人就像是编译器,书包就像是编译时候所有包含的库,而这张纸就好比我们声明的那个函数。当然,一般是不会有这样错误的,而昨天那同学却把Insert_a_Record的实现函数名写成了Insert_a_record。。。就导致了杯具。。。
个人blog域名http://www.cdusoft.com,欢迎大家来访讨论
记录下来,希望对其它同胞有点用~报这样错误的时候,注意两点:
如果XX部分是自己写的函数,就检查有没有实现这个函数,或者函数名有没有写正确。
如果XX部分是其它扩展库函数,就检查头文件有没有正确包含。(标准库没有包含一般会报first use this function)。
相关文章推荐
分享到:
相关推荐
BCB里遇到过的问题 [Linker Error] Unresolved external 'mysql_init' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR.LXSERVER\桌面\TESTINSERTMYSQL\UNIT1.OBJ 的解决方案
该资源通过简单的示例,给大家演示 进程共享内存技术的原理,以及实现。 技术要点: #pragma data_seg() ... #pragma commit(linker,"/section:...,rws")
ARM Compiler v5.01, Build 94, is intended for use as an update...This update consists of an updated compiler, linker, assembler, fromelf, and armar program executables, include files and C/C++ libraries.
C/C++ User’s Guide to TNT DOS-Extender (用户指南) A tutorial style guide to developing C and C++ programs for TNT DOS-Extender, including instructions for building programs using the Microsoft ...
此更新保证开发者在iOS 7上可以编译任何C/C++代码。因此,自V1.3以后的代码暂不开源。 7、利用theos可以从源代码编译iOS IPA程序。貌似不支持Storyboard。 !注意!如果需要安装产生的IPA,需要AppSync补丁,因为...
../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc' ../../lib/libopencv_core.so: undefined reference to `...
VC98linker链接器,用于链接obj文件,可以被C语言/C++/易语言调用
C/C++ User’s Guide to TNT DOS-Extender (用户指南) A tutorial style guide to developing C and C++ programs for TNT DOS-Extender, including instructions for building programs using the Microsoft ...
自己写的简单的TCP/UDP 例程 使用winsock 编程, 别忘记在linker里面添加 wsock32.lib!!!!! 可供网络编程project 参考
cguide.pdf Open Watcom C/C++ User’s Guide cguideq.pdf Open Watcom C/C++ Compiler and Tools User’s Guide for QNX 3rd Edition clib.pdf Watcom C Library Reference Volume 1 clr.pdf Open Watcom C ...
C/C++ User’s Guide to TNT DOS-Extender (用户指南) A tutorial style guide to developing C and C++ programs for TNT DOS-Extender, including instructions for building programs using the Microsoft ...
C/C++ User’s Guide to TNT DOS-Extender (用户指南) A tutorial style guide to developing C and C++ programs for TNT DOS-Extender, including instructions for building programs using the Microsoft ...
C/C++ User’s Guide to TNT DOS-Extender (用户指南) A tutorial style guide to developing C and C++ programs for TNT DOS-Extender, including instructions for building programs using the Microsoft ...
w64devkit is a Dockerfile that builds from source a small, portable development suite for creating C and C++ applications on and for x64 Windows. See "Releases" for pre-built, ready-to-use kits. ...
C/C++ User’s Guide to TNT DOS-Extender (用户指南) A tutorial style guide to developing C and C++ programs for TNT DOS-Extender, including instructions for building programs using the Microsoft ...
[Linker Error] Unresolved external 'viOpen' referenced from 这种错误的解决方法
VC98linker.rar //VC98linker.rar 易语言用到的。
Ubuntu64位编译Android源码出错解决办法
When you start using the IAR C/C++ compiler and linker for STM8, you should read Part 1. Using the build tools in this guide. When you are familiar with the compiler and linker and have already ...
为了混用汇编和C语言进行编程,就需要配套使用微软的C/C++语言编译器,也即是 Visual C++,它的前身是 Microsoft C/C++,最高版本好像是1992年的Microsoft(R) C/C++, Version 7.0,我手上就有MSC70.zip,还有1991年...