Config-Parser-C icon indicating copy to clipboard operation
Config-Parser-C copied to clipboard

Do you have an example file ready to compile pls?

Open noeldum opened this issue 3 years ago • 1 comments

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) {
      |     ^~~~~

noeldum avatar May 08 '21 13:05 noeldum