go-qml / qml

QML support for the Go language
Other
1.96k stars 187 forks source link

Windows Build Problem: ... qopenglversionfunctions.h:785:43: error: expected unqualified-id ... #56

Closed countcb closed 10 years ago

countcb commented 10 years ago

Hi,

building under Linux was no problem. But I'm struggling for a few days to try to build it under windows 7 with mingw.

Below is the error message I received. I also tried with Qt 5.2.1; same error.

I don't know what to do now... :( Any hints?

Thanks for the great work so far! Cheers, Christopher

>go get gopkg.in/qml.v0
# gopkg.in/qml.v0
In file included from C:/Qt/Qt5.1.1/5.1.1/mingw48_32/include/QtGui/qopenglcontext.h:63:0,
                 from C:/Qt/Qt5.1.1/5.1.1/mingw48_32/include/QtGui/QtGui:32,
                 from C:/Qt/Qt5.1.1/5.1.1/mingw48_32/include/QtOpenGL/QtOpenGLDepends:3,
                 from C:/Qt/Qt5.1.1/5.1.1/mingw48_32/include/QtOpenGL/QtOpenGL:3,
                 from gopkg.in\qml.v0\cpp/govalue.cpp:3,
                 from gopkg.in\qml.v0\all.cpp:3:
C:/Qt/Qt5.1.1/5.1.1/mingw48_32/include/QtGui/qopenglversionfunctions.h:785:43: error: expected unqualified-id before ')' token
     void (QOPENGLF_APIENTRYP MemoryBarrier)(GLbitfield barriers);
countcb commented 10 years ago

PS: I had to edit bridge.go to come this far

...
// #cgo CPPFLAGS: -IC:/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtCore/5.2.1/QtCore
...
saward commented 10 years ago

I recommend you try Qt 5.2.1. See below for more info.

I ran into this exact problem, which appears to be a bug in Qt, but someone recommends a change being made to Mingw's io.h recommended to get around it: http://qt-project.org/forums/viewthread/33370

However, I've just searched my mingw installation and it does not look like I made this change. So it may be that when I changed from Qt 5.1.1 to 5.2.1 that it resolved the issue (since another thread claims that this has been resolved -- http://stackoverflow.com/questions/18739688/compile-time-error-from-a-qt-file-expected-unqualified-id-before-token).

So if it's not a great hassle, I recommend using 5.2.1, since I am using that and have been able to get it running. It might be possible to edit files to get it to compile with 5.1.1, but as I said I can't seem to find those changes in my installation so I must have tried it (I remember trying it), achieved no success, moved to 5.2.1 and it worked. I wish my memory were better.

countcb commented 10 years ago

Thanks for the Info. But as said in the initial post the error is the same with Qt 5.2.1 :(

EDIT: It is exactly the same (besides the version Number)

>go get gopkg.in/qml.v0
# gopkg.in/qml.v0
In file included from C:/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtGui/qopenglcontext.h:63:0,
                 from C:/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtGui/QtGui:32,
                 from C:/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtOpenGL/QtOpenGLDepends:3,
                 from C:/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtOpenGL/QtOpenGL:3,
                 from gopkg.in\qml.v0\cpp/govalue.cpp:3,
                 from gopkg.in\qml.v0\all.cpp:3:
C:/Qt/Qt5.2.1/5.2.1/mingw48_32/include/QtGui/qopenglversionfunctions.h:785:43: error: expected unqualified-id before ')' token
     void (QOPENGLF_APIENTRYP MemoryBarrier)(GLbitfield barriers);
                                           ^
saward commented 10 years ago

What is line 785 for you in include/QtGui/openglversionfunctions.h?

I'm trying to hunt down what change I made to fix this.

countcb commented 10 years ago

Thanks a lot for your help! Line 785 of qopenglversionfunctions.h is

    void (QOPENGLF_APIENTRYP MemoryBarrier)(GLbitfield barriers);

It is the same for 5.1.1 and 5.2.1

saward commented 10 years ago

I'm out of time for hunting down what changes I made for now, but I can tell you that my line reads as follows: void (QOPENGLF_APIENTRYP __MemoryBarrier)(GLbitfield barriers); I expect I made a corresponding change somewhere else to define __MemoryBarrier, but I cannot find it. I can't see anything in my mingw or qt source files defining it.

Hopefully that gives you a clue to proceed with for now, and if you're still stuck let me know and I'll take a deeper look when I have more time.

countcb commented 10 years ago

Thanks a lot. Will use the info you gave me to find a proper fix.

For the time being I "fixed" the problem by simply commenting the line 785 out... (Since this method is part of the class QOpenGLFunctions_4_2_CoreBackend it was worth a try)

Was able to go get go-qml and run the particle example!

The only problem I had with it was that the particle.exe command did not return once I closed the window...but that's another thing to look into.

saward commented 10 years ago

Yes, I have that problem as well, not just with the particle example. I have not looked into it in detail yet, and I should file a bug report on it!

Also worth noting is that custom GL code is very unstable or flat out doesn't work at the moment. However, when you stick to using other parts of QML, and not writing your own custom GL, it seems to work. Gustavo is working on Qt entry points for GL which should hopefully make cross-platform custom GL work.

countcb commented 10 years ago

Ah, good to know. Thanks for that Info!

I think i will close this issue for now...?

saward commented 10 years ago

One final note: if I'm reading the posts elsewhere correctly, this should be fixed in a future version of Qt.

boppreh commented 10 years ago

Just downloaded Qt5.3 beta and the problem persists in this version.

yoavmil commented 10 years ago

yep, happend to me too, with Qt5.3. had to change

if defined(Q_OS_WIN)

include <QtCore/qt_windows.h>

endif

to

if defined(Q_OS_WIN)

include <QtCore/qt_windows.h>

undef MemoryBarrier

endif

at C:\Qt\5.3\mingw482_32\include\QtGui\qopengl.h got it from http://stackoverflow.com/questions/18739688/compile-time-error-from-a-qt-file-expected-unqualified-id-before-token/21872128#21872128