1. Tommaso Urli
  2. JSON++
  3. Issues
Issue #2 resolved

Make on cygwin (Win64) produces errors

mcross1882
created an issue

Hello,

When compiling on cygwin the compiler generates the following errors...

json.y:15:20: error: variable or field ‘load_file’ declared void
json.y:15:20: error: ‘FILE’ was not declared in this scope
json.y:15:25: error: expected primary-expression before ‘)’ token
json.y: In function ‘JSON::Value parse_file(const char*)’:
json.y:131:5: error: ‘FILE’ was not declared in this scope
json.y:131:11: error: ‘fh’ was not declared in this scope
json.y:131:35: error: ‘fopen’ was not declared in this scope
json.y:136:21: error: ‘load_file’ was not declared in this scope
json.y: In function ‘void yyerror(const char*)’:
json.y:173:13: error: ‘stderr’ was not declared in this scope
json.y:173:37: error: ‘fprintf’ was not declared in this scope
lex.yy.c: In function ‘void yy_init_buffer(YY_BUFFER_STATE, FILE*)’:
lex.yy.c:1455:59: error: ‘fileno’ was not declared in this scope
Makefile:6: recipe for target `test' failed
make: *** [test] Error 1

A lot of the errors can be resolved by including cstdio in your top code block in json.y like so...

%{

    #include <iostream>
    #include <cstring>
    #include <stdexcept>
    #include <cstdio>
    #include "json_st.hh"

    extern "C" 
    {
        void yyerror(const char *);
        int yylex();
    }

    // ... 

With the above modifications the error stack reduces to this...

lex.yy.c: In function ‘void yy_init_buffer(YY_BUFFER_STATE, FILE*)’:
lex.yy.c:1455:59: error: ‘fileno’ was not declared in this scope
Makefile:6: recipe for target `test' failed
make: *** [test] Error 1

System Specs

  • Windows 8 (x86_64)
  • Cygwin GCC Suite (v4.7.3)
  • Command: make

This is a the library that I've been looking for -- as it would integrate with a few of my projects perfectly -- so if you need more bug information please do not hesitate to ask.

Thanks

Comments (4)

  1. mcross1882 reporter

    Awesome, you'll notice that error is in the generated parser files. The line that will give you trouble deals with calling yyinteractive I've played around with disabling the interactive option with Bison but this doesn't seem to solve the issue. Good luck man!

  2. Log in to comment