glog Windows Visual Studio 2013 编译项目

glog 基本使用

glog基本使用

静态链接glog.lib库

1. Error C1189#error:  ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h.
See the document for detail.gameserverd:mycodecodeglogsrcwindowsgloglog_severity.h55

2. Error LNK2019unresolved external symbol "__declspec(dllimport) public: __thiscall google::LogMessage::LogMessage(char const *,int)" 
(__imp_??0LogMessage@google@@QAE@PBDH@Z) referenced in function "private: void __thiscall MainFrame::OnHello(class wxCommandEvent &)" 
(?OnHello@MainFrame@@AAEXAAVwxCommandEvent@@@Z)  gameserver D:mycodecodegameservermain.obj1

glog如何采用静态链接的方式呢?

  1. 在自定义工程中添加GOOGLE_GLOG_DLL_DECL=,此宏才是使用静态链接库时必须的!
  2. GLOG_NO_ABBREVIATED_SEVERITIES这两个宏,第二个宏主要是为了避免与windows.h冲突(下面会讲到),

参考

glog vs2015 编译问题

原文地址:https://www.cnblogs.com/flyinggod/p/14829984.html