bytedeco / javacpp

The missing bridge between Java and native C++
Other
4.43k stars 576 forks source link

Parser cannot compile because of QT #726

Closed iexavl closed 8 months ago

iexavl commented 8 months ago

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?

saudet commented 8 months ago

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

iexavl commented 8 months ago

@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?

saudet commented 8 months ago

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!

saudet commented 8 months ago

Duplicate of #51