Question

I'm trying to compile the hello.c that is provided under examples with mongoose. I keep getting the error:

mongoose.c:4752:27: error: '_strtoi64' was not declared in this scope

I looked at mongoose.c and _strtoi64 is defined on line 109 in an :

#if defined(_MSC_VER) && _MSC_VER < 1300
#define STRX(x) #x    
#define STR(x) STRX(x)    
#define __func__ __FILE__ ":" STR(__LINE__)
#define strtoull(x, y, z) strtoul(x, y, z)    
#define strtoll(x, y, z) strtol(x, y, z)    
#else    
#define __func__  __FUNCTION__    
#define strtoull(x, y, z) _strtoui64(x, y, z)    
#define strtoll(x, y, z) _strtoi64(x, y, z)    
#endif // _MSC_VER

I tried defining out side the if defined but i get the same error.
I saw: link But it looks like the version of the code that I have already has this "fix" in there.

I looked at some of the other the intro mongoose questions but I wasn't experiencing any of the issues.

Thanks in advance

Was it helpful?

Solution

I wouldn't consider Microsoft Visual C++ a valid C compiler. It supports C89, which mostly has subset compatibility with C++. However, since C89, two more standards have been adopted: C99 and C11. It's unreasonable to suggest that a C compiler can't compile C code from 1999. A valid C99 compiler will compile this code correctly.

In short, use a C compiler to compile C code and a C++ compiler to compile C++ code. If you need to link some C code to a C++ project, compile your C code with a C compiler and link it to your C++ project using your C++ linker.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top