Config-Parser-C
Config-Parser-C copied to clipboard
Do you have an example file ready to compile pls?
I landed here and gave it a try with the example provided. First it complained of many include missing. I had to add these below to parser.h
#include <cstdio>
#include <cstddef>
#include <cstdlib>
#include <cstring>
Does it makes sense?
Now I am stuck with the compilation error below.
In file included from config_reader.cpp:1:
parser.h: In function ‘config_option* read_config_file(char*)’:
parser.h:29:25: error: invalid conversion from ‘void*’ to ‘config_option_t’ {aka ‘config_option*’} [-fpermissive]
29 | if ((co = calloc(1, sizeof(config_option))) == NULL)
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void*
config_reader.cpp: At global scope:
config_reader.cpp:4:5: error: expected unqualified-id before ‘if’
4 | if ((co = read_config_file("./001.conf")) == NULL) {
| ^~
config_reader.cpp:8:5: error: expected unqualified-id before ‘while’
8 | while(1) {
| ^~~~~