问题描述
lpsolve5.5用flex生成了一个头文件,用bison生成了一个.c文件
lp_rlp.h: lp_rlp.l
$(LEX) lp_rlp.l
sed -e “s/yy/lp_yy/g” lex.yy.c >lp_rlp.h
rm -f lex.yy.c
lp_rlp.c: lp_rlp.y
$(YACC) lp_rlp.y
sed -e “s/yy/lp_yy/g” y.tab.c >lp_rlp.c
rm -f y.tab.c
lp_rlp.o: lp_rpl.h lp_rlp.c
但是他在头文件里使用了一堆定义在C文件里的宏:
···
/* Tokens. */
#define VAR 258
#define CONS 259
#define INTCONS 260
#define VARIABLECOLON 261
#define INF 262
#define SEC_INT 263
#define SEC_BIN 264
#define SEC_SEC 265
#define SEC_SOS 266
#define SOSDESCR 267
#define SEC_FREE 268
#define TOK_SIGN 269
#define AR_M_OP 270
#define RE_OPEQ 271
#define RE_OPLE 272
#define RE_OPGE 273
#define END_C 274
#define COMMA 275
#define COLON 276
#define MINIMISE 277
#define MAXIMISE 278
#define UNDEFINED 279
···
这下在新版的mingw里就炸了,跳出一堆找不到定义的错误。
解决方案
移动这些宏定义到头文件即可。