S
S
Slavka2015-11-14 18:18:22
C++ / C#
Slavka, 2015-11-14 18:18:22

How to limit the library usage area?

Such a problem is that two libraries are connected in main, but it turned out that the same types are redefined in different ways, and a conflict arises that the "BOOL" type is defined twice through typedef, how to avoid this conflict?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Tsilyurik, 2015-11-14
@Slavka_online

main includes two libraries,

Judging by the further text, it's not 2 libraries that bother you, but 2 header files (*.h)?
If these are header files from your project, then you can overlay the preprocessor in each of them:
#ifndef BOOL
typedef ... BOOL // как вы там его определяете?
#endif

If these are headers from some standard packages, in the code of which there is no point in changing something, then try something like this when connecting them:
#include <xxx.h>
#undef BOOL
#include <yyy.h>

This is all provided that your 2 BOOL definitions are identical (or at least compatible). Otherwise... you've arrived.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question