cesanta / v7

Embedded JavaScript engine for C/C++
Other
1.43k stars 177 forks source link

Error building on windows 8.1 #506

Open Evol-Intent opened 9 years ago

Evol-Intent commented 9 years ago

I tried to use v7 in one of my projects, but I get an error during the compilation:

D:\proj\v7>mingw32-make
g++ v7/v7.c main.cpp -I v7 -o hello
v7/v7.c:1005:0: warning: "popen" redefined [enabled by default]
 #define popen(x, y) _popen((x), (y))
 ^
In file included from v7/v7.c:49:0:
C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/stdio.h:500:0: note: thi
s is the location of the previous definition
 #define popen _popen
 ^
v7/v7.c:1006:0: warning: "pclose" redefined [enabled by default]
 #define pclose(x) _pclose(x)
 ^
In file included from v7/v7.c:49:0:
C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/stdio.h:501:0: note: thi
s is the location of the previous definition
 #define pclose _pclose
 ^
v7/v7.c:8574:3: warning: this decimal constant is unsigned only in ISO C90 [enab
led by default]
   if (!ok || res >= UINT32_MAX) return v7_create_undefined();
   ^
v7/v7.c:1274:41: error: declaration of C function 'int strnlen(const char*, size
_t)' conflicts with
 int strnlen(const char *s, size_t maxlen);
                                         ^
In file included from C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/io
.h:10:0,
                 from C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/sy
s/stat.h:14,
                 from v7/v7.c:922:
C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/string.h:55:18: error: p
revious declaration 'size_t strnlen(const char*, size_t)' here
   size_t __cdecl strnlen(const char *_Str,size_t _MaxCount);
                  ^
v7/v7.c: In function 'int c_vsnprintf(char*, size_t, const char*, va_list)':
v7/v7.c:4944:71: error: call of overloaded 'strnlen(const char*&, int&)' is ambi
guous
         int pad = field_width - (precision >= 0 ? strnlen(s, precision) : 0);
                                                                       ^
v7/v7.c:4944:71: note: candidates are:
In file included from C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/io
.h:10:0,
                 from C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/sy
s/stat.h:14,
                 from v7/v7.c:922:
C:/Program Files (x86)/mingw32/i686-w64-mingw32/include/string.h:55:18: note: si
ze_t strnlen(const char*, size_t)
   size_t __cdecl strnlen(const char *_Str,size_t _MaxCount);
                  ^
v7/v7.c:4809:5: note: int strnlen(const char*, size_t)
 int strnlen(const char *s, size_t maxlen) {
     ^
Makefile:5: recipe for target 'all' failed
mingw32-make: *** [all] Error 1

D:\proj\v7>

My makefile looks like this: v7.h and v7.c are in D:\proj\v7\v7, and main.cc is in D\proj\v7

# the compiler to use.
CC=g++

all: v7/v7.c main.cpp
    $(CC) v7/v7.c main.cpp -I./v7 -o hello