error C1189: #error: <glog/logging.h> was not included correctly.
使用vcpkg编译的glog
,包含logging.h
后编译下面的代码:
#include<glog/logging.h>
#include<iostream>
int main()
{
printf("Test\n");
return 0;
}
报错:error C1189: #error: <glog/logging.h> was not included correctly.
这是由于,自0.7.0版本起,包含logging.h
前需要定义宏GLOG_USE_GLOG_EXPORT
。logging.h
中代码如下所示:
包含GLOG_USE_GLOG_EXPORT
宏之后,logging.h
中关于GLOG_EXPORT
和GLOG_NO_EXPORT
的宏定义就都会生效。因此就不会产生上述错误信息。
添加GLOG_USE_GLOG_EXPORT
定义后的代码如下:
#define GLOG_USE_GLOG_EXPORT
#include<glog/logging.h>
#include<iostream>
int main()
{
printf("Test\n");
return 0;
}
标签:USE,include,logging,GLOG,EXPORT,error,报错,glog
From: https://blog.csdn.net/qq_42679415/article/details/139579438