ubuntu netbeans compile ygopro client with google protobuf lib
environment:
ubuntu 16.04
netbeans 8.2
ygopro Fluorohydride with Irrlicht Game Engine
问题1: google protobuf 提示 string ambiguous, string 类型和 Irrlicht 引擎冲突。
尝试的方法:
1、修改protobuf源码 string -> ::std::string。(冲突项太多,放弃这个方法。)
2、调整编译顺序,将pb.h放到include顶部,优先编译。
问题2: google protobuf 提示 不允许-fno-rtti
解决方法: CFLAGS 移除 -fno-rtti
问题3: netbeans IDE 导入 ygopro cpp 项目 from makefile,编译单个文件 通过,编译项目 通过,链接protobuf失败,提示 “undefined reference to `tutorial::Person_PhoneNumber::Person_PhoneNumber()'”。
尝试的方法:
`pkg-config --cflags --libs protobuf`
CFLAGS/CXXFLAGS/CXXFLAGS/LIBS += -D_GLIBCXX_USE_CXX11_ABI=0 -lprotobuf
LDDEPS += /usr/local/lib/libprotobuf.a /usr/local/lib/libprotobuf.so
@echo $(LINKCMD) 查看g++链接命令
添加生成obj: addressbook.pb.o
# GNU Make project makefile autogenerated by Premake
ifndef config
config=debug
endif ifndef verbose
SILENT = @
endif ifndef CC
CC = gcc
endif ifndef CXX
CXX = g++
endif ifndef AR
AR = ar
endif ifeq ($(config),debug)
OBJDIR = ../obj/Debug/ygopro
TARGETDIR = ../bin/debug
TARGET = $(TARGETDIR)/ygopro
DEFINES += -DLUA_USE_LINUX -D_DEBUG
INCLUDES += -I../ocgcore -I/usr/include/lua -I/usr/include/lua5. -I/usr/include/lua/5.2 -I/usr/include/irrlicht -I/usr/include/freetype2
CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES)
CFLAGS += $(CPPFLAGS) $(ARCH) -g -fno-strict-aliasing -Wno-multichar -std=gnu++0x
CXXFLAGS += $(CFLAGS)
LDFLAGS += -L../bin/debug
LIBS += -locgcore -lclzma -lIrrlicht -lfreetype -lsqlite3 -llua -levent -levent_pthreads -lGL -ldl -lpthread
RESFLAGS += $(DEFINES) $(INCLUDES)
LDDEPS += ../bin/debug/libocgcore.a ../bin/debug/libclzma.a
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS) /usr/local/lib/libprotobuf.a /usr/local/lib/libprotobuf.so
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
endif ifeq ($(config),release)
OBJDIR = ../obj/Release/ygopro
TARGETDIR = ../bin/release
TARGET = $(TARGETDIR)/ygopro
DEFINES += -DLUA_USE_LINUX -DNDEBUG
INCLUDES += -I../ocgcore -I/usr/include/lua -I/usr/include/lua5. -I/usr/include/lua/5.2 -I/usr/include/irrlicht -I/usr/include/freetype2
CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES)
CFLAGS += $(CPPFLAGS) $(ARCH) -g -O3 -fno-strict-aliasing -Wno-multichar -march=native -std=gnu++0x -fno-rtti
CXXFLAGS += $(CFLAGS)
LDFLAGS += -L../bin/release
LIBS += -locgcore -lclzma -lIrrlicht -lfreetype -lsqlite3 -llua -levent -levent_pthreads -lGL -ldl -lpthread -lprotobuf
RESFLAGS += $(DEFINES) $(INCLUDES)
LDDEPS += ../bin/release/libocgcore.a ../bin/release/libclzma.a
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef
endif OBJECTS := \
$(OBJDIR)/duelclient.o \
$(OBJDIR)/deck_con.o \
$(OBJDIR)/client_field.o \
$(OBJDIR)/single_duel.o \
$(OBJDIR)/materials.o \
$(OBJDIR)/netserver.o \
$(OBJDIR)/replay_mode.o \
$(OBJDIR)/CGUITTFont.o \
$(OBJDIR)/single_mode.o \
$(OBJDIR)/menu_handler.o \
$(OBJDIR)/event_handler.o \
$(OBJDIR)/gframe.o \
$(OBJDIR)/data_manager.o \
$(OBJDIR)/image_manager.o \
$(OBJDIR)/deck_manager.o \
$(OBJDIR)/replay.o \
$(OBJDIR)/client_card.o \
$(OBJDIR)/drawing.o \
$(OBJDIR)/tag_duel.o \
$(OBJDIR)/game.o \
$(OBJDIR)/CGUIImageButton.o \
$(OBJDIR)/addressbook.pb.o \ RESOURCES := \ SHELLTYPE := msdos
ifeq (,$(ComSpec)$(COMSPEC))
SHELLTYPE := posix
endif
ifeq (/bin,$(findstring /bin,$(SHELL)))
SHELLTYPE := posix
endif .PHONY: clean prebuild prelink all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)
@: $(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)
@echo Linking ygopro
@echo $(LINKCMD)
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS) $(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif $(OBJDIR):
@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(OBJDIR)
else
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif clean:
@echo Cleaning ygopro
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif prebuild:
$(PREBUILDCMDS) prelink:
$(PRELINKCMDS) ifneq (,$(PCH))
$(GCH): $(PCH)
@echo $(notdir $<)
-$(SILENT) cp $< $(OBJDIR)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
endif $(OBJDIR)/duelclient.o: ../gframe/duelclient.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/deck_con.o: ../gframe/deck_con.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/client_field.o: ../gframe/client_field.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/single_duel.o: ../gframe/single_duel.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/materials.o: ../gframe/materials.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/netserver.o: ../gframe/netserver.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/replay_mode.o: ../gframe/replay_mode.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/CGUITTFont.o: ../gframe/CGUITTFont.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/single_mode.o: ../gframe/single_mode.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/menu_handler.o: ../gframe/menu_handler.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/event_handler.o: ../gframe/event_handler.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/gframe.o: ../gframe/gframe.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/data_manager.o: ../gframe/data_manager.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/image_manager.o: ../gframe/image_manager.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/deck_manager.o: ../gframe/deck_manager.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/replay.o: ../gframe/replay.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/client_card.o: ../gframe/client_card.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/drawing.o: ../gframe/drawing.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/tag_duel.o: ../gframe/tag_duel.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/game.o: ../gframe/game.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/CGUIImageButton.o: ../gframe/CGUIImageButton.cpp
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"
$(OBJDIR)/addressbook.pb.o: ../gframe/addressbook.pb.cc
@echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<" -include $(OBJECTS:%.o=%.d)
ubuntu netbeans compile ygopro client with google protobuf lib的更多相关文章
- google protobuf使用
下载的是github上的:https://github.com/google/protobuf If you get the source from github, you need to gener ...
- Netty学习——Google Protobuf使用方式分析和环境搭建
Google Protobuf使用方式分析 在RPC框架中,Google Protobuf是很常用的一个库,和Apache Thrift 是同款的用于进行序列化的第三方库.原理都是大同小异,无非就是使 ...
- google protobuf初体验
最近在读别人代码的时候发现一个的东西,名字叫protobuf, 感觉挺好用的,写在这里,留个记录.那么什么是protobuf 呢?假如您在网上搜索,应该会得到类似这样的文字介绍: Google Pro ...
- Google protobuf
个人理解: 定义.proto文件就是指明消息里包含的成员和类型,protoc会compile成相应的java文件包含interface和implementation class,然后在构建messag ...
- 使用CSharp编写Google Protobuf插件
什么是 Google Protocol Buffer? Google Protocol Buffer( 简称 Protobuf) 是 Google 公司内部的混合语言数据标准,目前已经正在使用的有超过 ...
- (中级篇 NettyNIO编解码开发)第八章-Google Protobuf 编解码-2
8.1.2 Protobuf编解码开发 Protobuf的类库使用比较简单,下面我们就通过对SubscrjbeReqProto进行编解码来介绍Protobuf的使用. 8-1 Protob ...
- VS下使用Google Protobuf完成SOCKET通信
如何在Windows环境下的VS中安装使用Google Protobuf完成SOCKET通信 出处:如何在Windows环境下的VS中安装使用Google Protobuf完成SOCKET通信 最近一 ...
- netty 的 Google protobuf 开发
根据上一篇博文 Google Protobuf 使用 Java 版 netty 集成 protobuf 的方法非常简单.代码如下: server package protobuf.server.imp ...
- Google Protobuf 使用 Java 版
一 . Protobuf 的入门 Protobuf 是一个灵活,高效,结构化的数据序列化框架, 相比于 XML 等传统的序列化工具,它更小,更快,更灵活,更简单. Protobuf 支持数据结构化一次 ...
随机推荐
- GCC扩展 __attribute__ ((visibility("hidden")))
试想这样的情景,程序调用某函数A,A函数存在于两个动态链接库liba.so,libb.so中,并且程序执行需要链接这两个库,此时程序调用的A函数到底是来自于a还是b呢? 这取决于链接时的顺序,比如先链 ...
- java利用Google Zxing实现 二维码生成与解析
1.引入zxing 2.使用下面两个类:QRCodeUtil.java和BufferedImageLuminanceSource.java 3.新建单元测试类 复制下面测试代码即可. 1.pom文件中 ...
- 【转】Spring websocket 使用
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html https://spr ...
- MySQL check the manual that corresponds to your MySQL server version for the right syntax错误
地化GO的时候一直遇到一个错误就是check the manual that corresponds to your MySQL server version for the right syntax ...
- STM8S TIM4库函数应用
void TIM4_TimerInit(u8 Timer4Time) { assert_param(IS_TIM4TIMERTIME_OK(Timer4Time)); TIM4_DeInit();// ...
- CentOS开发环境LAMP搭建
CentOS开发环境搭建 -------------------------------------------------------------------------准备工作---------- ...
- [React] React Fundamentals: Component Lifecycle - Updating
The React component lifecycle will allow you to update your components at runtime. This lesson will ...
- Maven Build Profiles--reference
What is Build Profile? A Build profile is a set of configuration values which can be used to set or ...
- javascript源码阅读推荐
作者:马 岩(Furzoom) (http://www.cnblogs.com/furzoom/)版权声明:本文的版权归作者与博客园共同所有.转载时请在明显地方注明本文的详细链接,未经作者同意请不要删 ...
- JUnit4注解基本介绍
@After If you allocate external resources in a Before method you need to release them after the test ...