У меня есть следующая модель:
AutoGen Definitions options;
prog-name = checkopt;
prog-title = "Checkout Automated Options";
long-opts;
gnu-usage; /* GNU style preferred to default */
flag = {
name = address;
value = a;
arg-type = string;
max = 1;
stack-arg;
descrip = "Set listening IP address";
doc = 'IP address to bind with server';
};
И makefile :
DIST_PATH = ../dist
LIB_PATH = $(DIST_PATH)/libs
BUILD_PATH = ../build/server
DEF_PATH = def
GEN_PATH = $(BUILD_PATH)/gen
MKDIR_P = mkdir -p
RM_RF = rm -rf
AUTOGEN = autogen
CP = cp
MV = mv -f
.PHONY: all
SHELL = /bin/sh
CC = gcc
FLAGS = -std=gnu99
GEN_CFLAGS = -g -DTEST_SERVER `autoopts-config cflags`
GEN_LDFLAGS = `autoopts-config ldflags`
CFLAGS = -fPIC -pedantic -Wall -Werror $(GEN_CFLAGS)
LDFLAGS = -llog -lrt -lconfig $(GEN_LDFLAGS)
HEADERS = -Iinclude -I../common/include -I$(GEN_PATH)
OBJS = $(addprefix $(BUILD_PATH)/, $(patsubst %.c, %.o, $(wildcard *.c))) $(BUILD_PATH)/checkopt.o
all: gen server
dirs:
$(MKDIR_P) $(GEN_PATH)
gen:
$(AUTOGEN) $(DEF_PATH)/checkopt.def
$(MV) checkopt.c checkopt.h $(GEN_PATH)
$(BUILD_PATH)/checkopt.o:
$(CC) $(FLAGS) $(CFLAGS) $(HEADERS) -c $(GEN_PATH)/checkopt.c -o $(BUILD_PATH)/checkopt.o
$(BUILD_PATH)/%.o: %.c
$(CC) $(FLAGS) $(CFLAGS) $(HEADERS) -c $< -o $@
server: $(OBJS)
$(CC) -L$(LIB_PATH) -Wl,-rpath=$(LIB_PATH) $(FLAGS) $(CFLAGS) -o $(DIST_PATH)/server $^ $(LDFLAGS)
Использование официальной документации Я инициализирую tOptions
структура:
int load_settings(int argc, char **argv) {
tOptions opts;
optionProcess(&opts, argc, argv);
return 0;
}
Но мое приложение (./server --help
) вылетает с ошибкой:
Automated Options Processing Error!
./server called AutoOpts function with structure version 0:0:0.
This is less than the minimum library version: 41:1:16
(AutoOpts bug): optionProcess() was called with invalid data.
Как это исправить?Я даже не могу получить причину ошибки.
PS Ссылка на репозиторий .