So, a vendor that we use has provided a library (primarily for C, with some C++ support) that does the following:
#ifndef int64_t
#define int64_t s_int64
#endif
#ifndef int32_t
#define int32_t s_int32
#endif
#ifndef int16_t
#define int16_t s_int16
#endif
#ifndef int8_t
#define int8_t s_int8
#endif
In one of their headers deep inside their library. Now the problem is that once their library is included in simple C++11 code such as:
#include <iostream>
#include <vendor/library.h>
int main(void)
{
std::int32_t std_i = 0;
return std_i;
}
There is immediately a compiler error, (s_int32
is not in std::
). So question is, short of nagging the vendor to this fix this, is there anyway to workaround this in our code? (btw. things that I have tried, #include <cstdint>
before their headers, no luck; extern "C"
wrapper, no luck. The headers are installed in /usr/include/
so no control over order of inclusion I guess as well...)
You can undefine their definitions.
#undef int64_t
#undef int32_t
#undef int16_t
#undef int8_t
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With