-1

I need to use a library with FLTK GUI. The new library has a defined constant that is already used by X11 and it is in X.H. the constant is "None" Because of that I cannot compile the project. The same project works on Windows just fine. The only problem is the use of X.H which has the same constant that is used by the other library. Is there any way to fix that problem? Thanks in advance.

Mariwan
  • 95
  • 1
  • 5
  • In order to avoid name clashes, there are either prefixes (for C code) or namespaces (for C++). One or both libraries isn't using them or maybe even using evil macros, which is a bug. File a bug report. Also, apart from FLTK/X11, which is the other library polluting the global namespace? – Ulrich Eckhardt Aug 04 '14 at 11:24
  • The other one is a part of a vision cam library toolkit and the constant variable is in Genicam library. It must be a bug – Mariwan Aug 04 '14 at 12:58

1 Answers1

0

As a temporary fix, check if both define the same value. If not, you're screwed, complain to the lib authors.

Then, add #ifndef to enclose the #define like this:

#ifndef FOO
#define FOO 1
#end
Non-maskable Interrupt
  • 3,841
  • 1
  • 19
  • 26
  • No, actually both are distributed library. One is the X server library and the other is for a Vision Camera which uses Genicam. – Mariwan Aug 04 '14 at 12:56