bytedeco / javacpp

The missing bridge between Java and native C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parser cannot compile because of QT

iexavl opened this issue · comments

I am trying to use QT in conjunction with java and I am currently having trouble compiling the parsed classes on the java side. It gives me this error:
C:\Qt\6.5.2\mingw_64\include\QtCore/qcompilerdetection.h(1220): fatal error C1189: #error: "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler."
It seems I need to compile with a couple more compiler options like /std:c++17 and /Zc:__cplusplus. Is there a way to tell the parser it needs to add these when its calling cl to compile the generated source files?

Sure, use @Platform(compiler="cpp17", ...) for that.

@saudet That does work. Although I can't pass the permissive- option. Any idea why? And another thing I was wondering is the includes in QT are separated in different folders. Like lots of folders and the header files I need included are spread across these folders, is there a way to tell the parser to look through the whole file tree in that folder for include files?

If you're using the command line interface, we can use the -Xcompiler option to pass anything we want:
https://github.com/bytedeco/javacpp/blob/master/src/main/java/org/bytedeco/javacpp/tools/Builder.java#L1338

As for any signification enhancement to the parser, I'll just consider that as a duplicate of #51, but contributions are welcome!

Duplicate of #51