在一个vs2013解决方案下创建了三个工程文件,在其中一个工程(Foundation)中放有CtrlMessage.pb.h和ControlMessageTags的头文件。编译后出错总共68处。

错误 2 error LNK2019: 无法解析的外部符号 "void __cdecl google::protobuf::internal::VerifyVersion(int,int,char const *)" (?VerifyVersion@internal@protobuf@google@@YAXHHPBD@Z),该符号在函数 "void __cdecl CtrlMsg::protobuf_AddDesc_CtrlMessage_2eproto(void)" (?protobuf_AddDesc_CtrlMessage_2eproto@CtrlMsg@@YAXXZ) 中被引用 F:\StartServer2013\StartServer\Foundation.lib(CtrlMessage.pb.obj) ControlCenter

错误 61 error LNK2001: 无法解析的外部符号 "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const google::protobuf::internal::kEmptyString" (?kEmptyString@internal@protobuf@google@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B) F:\StartServer2013\StartServer\Foundation.lib(CtrlMessage.pb.obj) ControlCenter

打开Foundation工程属性页,在“附加依赖项”增加protobuf库文件libprotobuf.lib,然后把以前用VS2010编译库文件复制Founddation同级目录下,Foundation工程编译通过。

然后在另一个引用Foundtion工程中,编译出错总共38处

错误 8 error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1600”不匹配值“1800”(StartServerDlg.obj 中) F:\StartServer2013\StartServer\Foundation.lib(common.obj) ControlCenter

错误 35 error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1600”不匹配值“1800”(StartServerDlg.obj 中) F:\StartServer2013\StartServer\Foundation.lib(stringprintf.obj) ControlCenter

然后ControlCenter项目的平台工具集改成vs2010,错误只有5个,

错误 1 error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1600' in StartServerDlg.obj F:\StartServer2013\StartServer\Foundation.lib(CtrlMessage.pb.obj) ControlCenter

错误 3 error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xbad_alloc(void)" (__imp_?_Xbad_alloc@std@@YAXXZ) referenced in function "char * __cdecl std::_Allocate<char>(unsigned int,char *)" (??$_Allocate@D@std@@YAPADIPAD@Z) F:\StartServer2013\StartServer\Foundation.lib(CtrlMessage.pb.obj) ControlCenter

于是想到可能是由于protobuf的库文件是VS2010编译的。于是用VS2013重新打开PROTOBUF源文件重新编译2013版的protobuf,将编好的libprotobuf.lib文件复制到FOUNDATION工程目录下,依次编译foundation工程和ControlCenter工程,编译成功。总结VS2010和VS2013编译出的PROTOBUF的LIB文件不能交叉引用。

protobuf遇坑总结的更多相关文章

  1. redis 集群 遇坑1

    redis 集群 遇坑1 redis集群需要开2个端口 一个是客户端连接端口 一个是 集群总线端口 集群总线端口 是 客户端端口 + 10000 如 客户端端口是 6380 则集群总线端口 为 163 ...

  2. SpringCache实战遇坑

    1. SpringCache实战遇坑 1.1. pom 主要是以下两个 <dependency> <groupId>org.springframework.boot</g ...

  3. 浅谈Android Studio3.0更新之路(遇坑必入)

    >可以参考官网设置-> 1 2 >> Fantasy_Lin_网友评论原文地址是:简书24K纯帅豆写的我也更新一下出处[删除]Fa 转自脚本之家 浅谈Android Studi ...

  4. Cat搭建遇坑记

    1. Cat搭建遇坑记 1.1. 报错 服务端启动 Unable to get component: class com.dianping.cat.analysis.TcpSocketReceiver ...

  5. Windows安装Scrapy遇坑解决办

    PS: Windows真心不适合开发.且行且珍惜.... 坑: error: Setup script exited with error: Microsoft Visual C++ 9.0 is r ...

  6. Java之戳中痛点 - (6)避免类型自动转换,例如两个整数相除得浮点数遇坑

    先来看一个例子: package com.test; public class calculate { /** * 光速30万公里/秒 */ public static final int LIGHT ...

  7. Android组件化demo实现以及遇坑分享

    首先贴出demo的github地址:GitHub - TenzLiu/TenzModuleDemo: android组件化demo 作者:TenzLiu原文链接:https://www.jianshu ...

  8. phalcon安装-遇坑php-config is not installed 解决方法

    通过源码编译安装php环境,按照phalcon官方文档安装扩展,会遇到php-config is not installed的坑. 尝试通过下列命令可以解决: cd /opt/cphalcon-/bu ...

  9. unity 2d 游戏优化之路 遇坑记录

    情景说明:  unity 出的Android包,在目前一些主流机型跑都没有问题,但是在 小米3 这种比较老的机器上跑,报如下错误 GLSL compilation failed, no infolog ...

  10. [win10]遇坑指南

    好多不好用的地方,现在解决的差不多了,把经验分享一下,也方便自己下一次重装 win10 时不再进坑. 1. 输入法:https://zhidao.baidu.com/question/45942172 ...

随机推荐

  1. XAF特性属性记录

    1.[XafDisplayName("名称")] (1)在类上面表示修改左侧菜单的名称 (2)在字段属性上使用表示修改字段名称 2.[ImageName("Actions ...

  2. Word14 互联网络发展状况统计报告office真题

    1.课程的讲解之前,先来对题目进行分析,首先需要在考生文件夹下,将Wrod素材.docx文件另存为Word.docx,后续操作均基于此文件,否则不得分. 2.这一步非常的简单,打开下载素材文件,在[文 ...

  3. MyFreeMarkerConfigurer

    public class MyFreeMarkerConfigurer extends FreeMarkerConfigurer { @Override public void afterProper ...

  4. Win10 笔记本禁用/启用自带键盘

    文章来源:华硕笔记本怎么禁用自带键盘_虽千万里,吾往矣!的博客-CSDN博客_华硕笔记本怎么禁用自带键盘 在小娜搜索栏中输入cmd,找到命令提示符(cmd),并且右键以管理员身份运行. 在弹出的窗口中 ...

  5. asp.net.core学习笔记1:swagger的使用和webapi接收Jobject对象

    环境:asp.net.core 3.1 (一觉醒来官方已经不推荐3.0了,于是没有任何core经验,也只能开始了3.1的开发学习) 由于现有项目前后端分离.微服务化日趋流行,所以上手不采用web应用( ...

  6. 使用a标签锚点实现顺滑效果

    scroll-behavior:smooth;//使用该方法使用a标签锚点的时候会实现平滑 xxx.scrollIntoView({ behavior: "smooth" })

  7. linux下yum安装时出现Loaded plugins: fastestmirror

    linux使用yum安装软件时出现报错Loaded plugins:fastestmirror,是提示这个插件不能使用了,fastestmirror是yum的一个加速插件, 解决的办法是:将这个插件禁 ...

  8. centos 7 删除乱码文件

    1.通过ls -li 获取要删除乱码文件名文件的inode号,比如得到的是 33575029 2.通过以下命令删除文件:find ./ -inum 33575029 -exec rm -rf {} \ ...

  9. uni小程序保存base64图片

    使用uni.getFileSystemManager().writeFile去下载base64图片<view class="share-btn" @click="s ...

  10. 【解决办法】安装Boost 提示'cl'不是内部或外部命令

    VisualStudio 2022 Community 亲测可用. 1. 检查下载版本是否是最新版,我开始下的1.66.0会报错,后来换成1.79.0就没问题.官网https://www.boost. ...