vc6用unicode 编码方式来编译程序

1.打开项目设定的C++ 页面,添加UNICODE,_UNICODE两个宏定义:

2. 在link页面,更改入口函数为wWinMainCRTStartup:

 

注意:编译的时候需要用到unicode的链接库,默认情况下不会安装,重新装上编译就应该通过!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
为了在VC6中编译protobuf,需要进行以下步骤: 1.下载protobuf源代码并解压缩。 2.打开VS6,创建一个新的Win32控制台应用程序。 3.将protobuf源代码中的src目录添加到项目中。 4.在项目属性中,选择C/C++选项卡,然后选择预处理器选项卡。在预处理器定义中添加HAVE_PTHREAD。 5.在项目属性中,选择C/C++选项卡,然后选择代码生成选项卡。在运行库中选择多线程调试(/MTd)。 6.在项目属性中,选择链接器选项卡,然后选择输入选项卡。在附加依赖项中添加libprotobuf.lib。 7.在项目属性中,选择链接器选项卡,然后选择系统选项卡。在子系统中选择控制台(/SUBSYSTEM:CONSOLE)。 8.编译并运行程序。 ```shell // 示例代码 #include <iostream> #include <fstream> #include <string> #include "google/protobuf/message.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/compiler/importer.h" #include "google/protobuf/dynamic_message.h" #include "addressbook.pb.h" using namespace std; using namespace google::protobuf; using namespace google::protobuf::compiler; int main(int argc, char* argv[]) { GOOGLE_PROTOBUF_VERIFY_VERSION; DiskSourceTree sourceTree; sourceTree.MapPath("", "./"); Importer importer(&sourceTree, NULL); importer.Import("addressbook.proto"); const Descriptor* descriptor = importer.pool()->FindMessageTypeByName("tutorial.Person"); const Message* prototype = importer.pool()->FindMessageTypeByName("tutorial.Person")->prototype(); DynamicMessageFactory factory; Message* message = factory.GetPrototype(descriptor)->New(); message->ParseFromString("..."); // 从字符串中解析出Message cout << message->DebugString() << endl; // 输出Message的Debug信息 delete message; google::protobuf::ShutdownProtobufLibrary(); return 0; } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值