I am using two different c++ libraries. Both libraries use a name for a type, let's say, called fofo. In lib1.h:
typedef short fofo;
In lib2.h:
namespace LIB2
{
typedef struct
{
uint16_t toto;
} fofo;
}
using LIB2::fofo;
I have a C++ project/VS 2008 that uses both libraries: when I do in my project
#include lib1.h
I get the error: error C2874: using-declaration causes a multiple declaration
I would like to use in my project both libraries but without making any change to these libraries. The only thing that I can modify is my VS2008 project. Thanks for your help!
this (dirty) workaround will probably work (depending how the headers are being used)
instead of including lib1.h directly ,wrap it by making a new headerfile
lib1wrapped.h
#define fofo fofo_wrap
#include "lib1.h" // OR <lib1.h>
#undef fofo
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