0

I'm taking over a project where I need to work with QT Creator and CImg, however it won't build on my machine.

/Users/vikkosmi/Qt/5.2.0/clang_64/lib/QtCore.framework/Headers/qvariant.h:132: error: expected '}'
    Bool = QMetaType::Bool,
    ^

This error, and a dozen similar ones, keeps appearing when I build. Its coming from the Qt Core.

Are there things that need to be rewritten when you move from a windows platform to osx using cimg? As far as I know the code should be portable..

I tried to reinstall libraries, install XQuarts, add library and include paths to the project file, but still the same problem :( Thanks in advance for your help!

Vikko
  • 1,396
  • 10
  • 23

2 Answers2

0

What are you building? If you're building Qt, then you have some local modifications that broke it - start with fresh sources.

If you're building some code that uses Qt, then the problem is in that code, not in Qt. The smell of this issue is that something has defined a Bool macro that interferes with QVariant's code.

The file where this happens is not qvariant.h. It is some .cpp file of yours - look at the error messages, they will include something like "while compiling yourfile.cpp". In that file, you need to put #include <QVariant> as the very first line. This should fix the problem temporarily.

You should search for Bool in your code and fix the global namespace pollution. Your code is broken, no doubt about it I think.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • Thanks for your input, I did a find for `Bool` in the whole project, its not listed anywhere. I'll see if putting on top will resolve anything (since multiple graphics libs are included everywhere). The code is a big mess and needs to be cleaned up, but I'd rather get it working first so I don't make it worse :) – Vikko Jan 22 '14 at 11:15
0

The X11 library (used by default by CImg) defines Bool. As you are working with Qt, you probably don't want to use display capabilities of CImg, so I suggest you deactivate it by defining the macro cimg_display=0when compiling. CImg will not try to include the X11 headers, and it may solve your problem.

bvalabas
  • 301
  • 1
  • 1
  • CImg is being used to render processed pictures, while Qt is used to render a command interface to adapt settings. I'm afraid that cimg_display=0 is not an option at the moment :( – Vikko Jan 22 '14 at 11:12
  • @Vikko It's only an inclusion order issue, as long as `QVariant` goes first it'll work. X11 headers are braindead, the Bool should have been typedef'd. – Kuba hasn't forgotten Monica Jan 22 '14 at 13:57
  • I tried including QVariant on the first line of main.cpp, which resulted in even more errors. I think this whole project in incompatible with OS/X, so I'm removing CImg from the project and will look for an alternative approach that will not need it. – Vikko Jan 23 '14 at 08:21