VC: error LNK2019:unresolved external symbol *** referenced in function ***的解决方案
- 博客分类:
- c++
当头文件中声明了一个函数,但是在相应的源文件中却没有对该函数进行定义,则会出现为“解决的外部符号”(unresolved external symbol )错误。另外,当一个函数调用了外部的一个库文件中的函数,但是在当前project的properties中并没有将所依赖的(dependent)库文件包含进来时,也会出现这种错误。
综上,当一个solution在linking时找不到所涉及到的函数的定义时就会出现“unresolved external symbol ”错误。
例如,下面是调用rapi的库文件rapi.lib中的函数时,由于没有将rapi.lib包含进来而导致的链接错误。
1>Linking...
WMFileSync.obj : error LNK2019: unresolved external symbol _CeFindClose@4 referenced in function "public: virtual long __stdcall CWMFileSync::IsFileExists(wchar_t *)" (?IsFileExists@CWMFileSync@@UAGJPA_W@Z)
【解决方案】
1. Project -> ** Properties... -> Configuration Properties -> Linker -> Input -> Additional Dependencies -> rapi.lib
另外,在此之前,还需添加rapi库的相应目录:Tools -> Options -> Projects and Solutions -> VC++ Directories -> Show Directories for -> 在Include files中添加C:\Program Files\Matrox Imaging\rapi\Include 以及 Tools -> Options -> Projects and Solutions -> VC++ Directories -> Show Directories for -> 在Library files中添加C:\Program Files\Matrox Imaging\rapi\LIB。添加目录的目的是为了使VC在调用相应库文件时不必总是使用绝对地址,VC可以通过文件名在所包含的目录中进行搜索。这样,前面的rapi.lib就不必使用绝对地址了。
【缺点】可移植性差,如果将原工程中的源文件和头文件中的内容copy下来重新建立该工程时(例如:在电子书或网络上找到的程序),仍需自己在工程中添加目录及所需的库文件。
2. 在程序前加入#pragma commet(lib, "rapi.lib")也可以达到相同的效果。
发表评论
-
const 与static 关键词在c 和 c++中的作用
2012-08-11 11:49 963一.C语言中的const ... -
error LNK2005 and error LNK2019
2012-08-09 23:08 1091error LNK2005 and error LNK2019 ... -
LIBCD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSV
2012-08-07 09:20 1378LIBCD.lib(crt0dat.obj) : error ... -
在VS2010下配置VC++ Directories
2012-08-07 08:29 10401:可以 在“class View” 面板 -> 右 ... -
零星笔记,待整理
2010-11-01 13:00 478//用 getline 函数从输入读取整行内容。然后为 ... -
stdcall cdecl fastcall thiscall naked call的具体含义
2010-10-30 18:54 954在C语言中,假设我们有 ... -
#define总结 (网上资料汇集)
2010-10-30 08:06 7111. 定义简单的常数:定义常量,便于修改(切不可在后面加上分号 ... -
(zz)编译与使用Qt4,Visual Studio Express 2008
2010-10-14 22:35 1371一、Qt版本 我现在用的是4.5.2。好像前段时间4.6出来 ... -
strcat 内部实现
2010-09-21 00:43 1794char * strcat(char * dest, ... -
deep copy & shallow copy
2010-09-15 19:27 810A shallow copy of an object cop ... -
reinterpret_cast的本质(转)
2010-09-14 23:15 1609先看看下面的代码: #include <iostr ... -
C++ 经典书籍
2010-09-14 16:18 1682下载地址: http://www.51cnnet.net/di ... -
内存对齐的规则以及作用
2010-09-14 00:14 685首先由一个程序引入话 ... -
[转]C++ reinterpret_cast,const_cast等 显式类型转换总结
2010-09-13 23:23 1007#include<iostream.h> ... -
C++提供了四种新的类型强制
2010-09-13 23:13 682static_cast const_cast reinte ... -
C++著名程序库的比较和学习经验
2010-09-13 19:30 8171、C++各大有名库的介绍——C++标准库 2、C++各大有名 ... -
c++ library and resource List
2010-09-13 18:56 8931,前言 无数次听 ... -
C++中操作符operator的两种用法
2010-09-12 02:23 11121.operator overloading C++可能通过o ... -
两种自动类型转换:构造函数与operator
2010-09-12 02:23 884如果有两个对象:one, two, 要想把one转换成为two ... -
C++中的类拷贝构造函数和模板拷贝构造函数
2010-09-11 20:53 2999类(包括模板类)构造函数是真实的构造函数;然而模板构造函数,其 ...
相关推荐
解决报错Error LNK2001:unresolved external symbol
解决error LNK2001: unresolved external symbol
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 msvcrtd.lib(crt
visual c++报error LNK2001 unresolved external symbol错就是因为你...
error LNK2001 unresolved external symbol _GetObjectContext.zip
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 msvcrtd.lib(crtexew.obj) : error LNK2001: ...
unresolved external symbol,multiply defined symbols found 这是一个困扰C语言新手的问题 #include没毛病 但是用多了就出毛病 看代码,哪都没毛病 在B中#include A 在A中#include B 此时build就会报unresolved ...
阐述了C++中vc中error LNK2001 resolved external symbol _WinMain@16的解决方法的解决方法。
player.obj : error LNK2001: unresolved external symbol _IID_IVideoWindow player.obj : error LNK2001: unresolved external symbol _IID_IMediaControl 这是因为链接器没有找到合适的.lib文件。两种办法: ...
解决vc报错error LNK2019 无法解析的外部符号,该符号在函数 中被引用
解决安装vs2012后vs2010 LINK : fatal error LNK1123: failure during conversion to COFF Wrong version: 03/18/2010 01:16 PM 31,048 cvtres.exe Correct version: 02/21/2011 06:03 PM 31,056 cvtres.exe
博文的配套源码 《【 Visual C++】游戏开发笔记之二——最简单的directx,vc窗口的编写 》 ,原文地址为http://blog.csdn.net/zhmxy555/article/details/7318634, 源码编译环境为vs2010. 我的博客地址是...
如何解决 error LNK2019 无法解析的外部符号,该符号在函数 中被引用
error LNK2005: DllMain already defined in corelibc.lib(dllmain.obj)的解决方案
error LNK2019: 无法解析的外部符号 问题的解决办法,需要的朋友可以参考一下
nafxcwd.lib(thrdcore.obj):error LNK2001:unresolved external symbol_endthreadex nafxcwd.lib(thrdcore.obj):error LNK2001:unresolved external symbol_beginthreadex Debug/MyMFC.exe:fatal error LNK1120:2 ...
本文实例讲述了VC外部符号错误_main,_WinMain@16,__beginthreadex解决方法。分享给大家供大家参考。具体如下: 在创建MFC项目时, 不使用MFC...LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _Wi
Printer.obj : error LNK2019: unresolved external symbol "protected: __thiscall Counted<class Printer>::Counted(void)" ([email=??0?$Counted@VPrinter@@@@IAE@XZ]??0?$Counted@VPrinter@@@@IAE@XZ[/email]) ...
vs2008-vc LNK2019,请高手指点