VS2010编译错误 LNK 2019 unresolved external symbol错误解决办法
Link错误有很多种,主要是没有在连接中加入lib文件路径,或者lib配置正确,传参错误
一个solution里面多个project之间引用其他project函数会出现这个错误,由于包含了头文件而没处理lib文件导致,解决办法有如下几种:
1.在引用外部函数的cpp文件的头文件包含列表下添加 #pragma comment(lib, "xxx.lib")
2.在引用其他动态库的工程的Properties->Configuration Properties->Linker->Additional Dependencies中添加lib文件路径
3.在引用其他动态库的工程的Properties->Common Properties->Framework and References中Add New Reference选择依赖的工程
最近遇到一个问题,lib配置正确,传参也没问题,仍报LNK2019。。。。找了许久发现是引用dll中的函数而没有使用dll函数导出配置代码如下
1: #pragma once
2:
3: #include "..\..\third-part\plustache\context.hpp"
4: #include "..\..\third-part\jsoncpp\json.h"
5:
6: class DataConversion {
7: public:
8: DataConversion();
9: ~DataConversion();
10: static Context JsonToContext(char *printData);
11: private:
12: static PlustacheTypes::ObjectType ConvertObject(const Json::Value& json, Context* ctx);
13: static PlustacheTypes::CollectionType ConvertCollection(const Json::Value& json);
14: static void ConvertPrimative(const Json::Value& json, CString& value);
15: };
16: //上面代码是一个dll中的头文件,需要在其他工程中使用 Context JsonToContext(char *printData);这个函数,怎么调用都是连接错误,后来想到是dll函数导出的问题,于是修改成如下代码即可
17: #pragma once
18:
19: #ifdef PRINTERPLUGIN_EXPORTS
20: #define PRINTERPLUGIN_API __declspec(dllexport)
21: #else
22: #define PRINTERPLUGIN_API __declspec(dllimport)
23: #endif
24:
25: #include "..\..\third-part\plustache\context.hpp"
26: #include "..\..\third-part\jsoncpp\json.h"
27:
28: class DataConversion {
29: public:
30: DataConversion();
31: ~DataConversion();
32: PRINTERPLUGIN_API static Context JsonToContext(char *printData);
33: private:
34: static PlustacheTypes::ObjectType ConvertObject(const Json::Value& json, Context* ctx);
35: static PlustacheTypes::CollectionType ConvertCollection(const Json::Value& json);
36: static void ConvertPrimative(const Json::Value& json, CString& value);
37: };
VS2010编译错误 LNK 2019 unresolved external symbol错误解决办法的更多相关文章
- error LNK2001: unresolved external symbol _main解决办法(zz)
error LNK2001: unresolved external symbol _main解决办法 解决外部符号错误:_main,_WinMain@16,__beginthreadex -!t ...
- OpenSceneGraph 编译 error LNK2019:unresolved external symbol 错误
在编译 OpenSceneGraph 的一个简单示例时, #include <osgViewer/Viewer> #include <osgDB/ReadFile> void ...
- [异常] VC6.0 error LNK2001: unresolved external symbol _main解决办法
来自:http://www.douban.com/note/65638800/ 学习VC++时经常会遇到链接错误LNK2001,该错误非常讨厌,因为对于编程者来说,最好改的错误莫过于编译错误,而一般说 ...
- VC6.0 error LNK2001: unresolved external symbol _main解决办法
学习VC++时经常会遇到链接错误LNK2001,该错误非常讨厌,因为对于编程者来说,最好改的错误莫过于编译错误,而一般说来发生连接错误时,编译都已通过.产生连接错误的原因非常多,尤其LNK2001错误 ...
- 链接报error LNK2019: unresolved external symbol错误,解决
http://blog.163.com/aiding_001/blog/static/22908192011102224344450/ 某次编写一个COM组件,接口定义好之后,增加了ZRX代码后编译链 ...
- unresolved external symbol __report_rangecheckfailure 解决思路
__report_rangecheckfailure 是用来检查堆栈缓存溢出的,如果编译的时候打开GS(project property-->Configuration properties- ...
- VS2010中使用QtOpenGL出现 unresolved external symbol __imp__glClear@4 referenced in function之类的错误
描述: 链接了QtOpenGL4.lib QtOpend4.lib的库啊,居然还是发生此错误. 原因是没有链接OpenGL32.lib这个库.所以,要添加这个lib 重新rebuild的一下,此类的错 ...
- 用keil编写的 C51错误 *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ?C_START
可能原因: 替换工程的文件未先 remove该文件. 正常替换文件步骤: 1. 右键 欲 替换的文件,remove XXXXX.c from build ----> remove XXXX ...
- C++: Unresolved external symbol __imp__fscanf
VS2019中遇到错误error LNK2001: unresolved external symbol __imp__fscanf 解决办法:链接legacy_stdio_definitions.l ...
随机推荐
- 关于高性能javascript 笔记
最近买了本新书,准备自己吃 狗粮的同时也吃点精神食粮.笔记总结,从现在开始,看我啥时候能看完这本酥,就酱紫, begin:
- Unity3DGUI:常用控件
- 在Proteus中添加标号
1.Proteus中添加组件后双击引脚可以快速生成一个最近的端口. 2.按A调出设置界面 3.在String中写:net=H#,"H"可以换成自定义前缀.count为起始值,inc ...
- R安装
linux: 在编译R之前,需要通过yum安装以下几个程序: #yum install gcc-gfortran #否则报”configure: error: No F77 ...
- 浙大pat1020题解
1020. Tree Traversals (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Suppo ...
- 启动Mysql报错:Another MySQL daemon already running with the same unix socket.
启动Mysql报错: Another MySQL daemon already running with the same unix socket. 删除如下文件即可解决 /var/lib/mysql ...
- C#中“类似GridView等控件”的前台显示与后台数据变化之间的关系
最近用dev的treelist,gridcontrol等控件,这些控件显示数据都需要进行DataTable等数据源的绑定,而经理又要求可以随时更改其中的内容,刚开始总是不断的刷新控件.更新控件的数据源 ...
- sqlmap基础使用
测试许多款 sql注入工具 最终还是发现 sqlmap 最为强悍 谁用谁知道!赶紧抛弃掉手上一大堆 sql 注入工具吧 : )测试环境:ubuntu 10.10 & windows 7(x64 ...
- css margin相关问题及应用
一.margin常见问题 1.IE6下双边距问题 margin双布局可以说是IE6下经典的bug之一.产生的条件是:block元素+浮动+margin. 2.maring重叠的问题 css2.0规范对 ...
- linux下安装tomcat,并设置自动启动
在linux系统下,设置某个服务自启动的话,需要在/etc/rcX.d下挂载,还要在/etc/init.d/下写启动脚本的 在/etc/init.d/下新建一个文件tomcat(需要在root权限下操 ...