问题描述
1.环境
- 操作系统:
Ubuntu 18.04 x64
- 构建工具:
apt install build-essential cmake -y
2.代码
文件名:repl.c
#include <stdint.h>
...
const uint32_t PAGE_SIZE = 4096; // 4*1024 bytes
#define TABLE_MAX_PAGES 100
const uint32_t ROWS_PER_PAGE = PAGE_SIZE / ROW_SIZE;
const uint32_t TABLE_MAX_ROWS = ROWS_PER_PAGE * TABLE_MAX_PAGES;
...
3. CMakefile
文件名:CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(sqlITE_CLONE)
add_executable(a.out repl.c)
4.错误重现
尝试构建:
cmake .
make
但是得到如下错误:
/home/ws/sqlite_clone_in_c/P3/repl.c:157:32: error: initializer element is not constant
const uint32_t ROWS_PER_PAGE = PAGE_SIZE / ROW_SIZE;
^~~~~~~~~
/home/ws/sqlite_clone_in_c/P3/repl.c:158:33: error: initializer element is not constant
const uint32_t TABLE_MAX_ROWS = ROWS_PER_PAGE * TABLE_MAX_PAGES;
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)