【发布时间】:2023-04-08 10:07:01
【问题描述】:
我的 configure.ac 文件有如下一行
AC_INIT([myApp], [1.2.3], [dev@company.com])
然后 autoheader/configure 将创建config.in,其中我们将有 2 个宏,如下所示,
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.2.3"
/* Version number of package */
#define VERSION "1.2.3"
我还需要在同一个项目中构建sqlite,并且sqlite头文件还定义了变量VERSION,然后我得到了如下错误
../../config.h:117:17: error: expected unqualified-id before string constant
#define VERSION "1.2.3"
^ ../../SQLiteCpp/include/SQLiteCpp/Database.h:35:21:note: in expansion of macro ‘VERSION’
extern const char* VERSION; ///< SQLITE_VERSION string from the sqlite3.h used at compile time
每次我都必须手动修改 config.in 以注释掉 VERSION 宏才能让构建继续。我的问题是:
- 为什么
config.h、PACKAGE_VERSION和VERSION创建的2个宏看起来一样,有什么区别? - 如何解决这个
VERSION宏/变量冲突问题?
谢谢
【问题讨论】:
标签: macros version conflict autoconf