Thanks. It compiles after making that change.

On a related point. I know this is an obscure platform specific part of Qt, but
it was my expectation that Qt would insulate me from compilation issues such as
this. Given that in this case it doesn't insulate me I would have expected to
find the advice in this thread somewhere in the documentation that is hard to
miss, preferably here:

https://doc.qt.io/qt-5/qcocoanativecontext.html

Did I miss the documentation somewhere else or should I submit a bug report?

Glenn

On 2/05/20 9:53 am, Jean-Michaël Celerier wrote:
> .m is Objective-C,  you want .mm (Objective-C++) AFAIK
> 
> Best,
> 
> On Fri, May 1, 2020 at 11:05 PM Glenn Ramsey <g...@componic.co.nz
> <mailto:g...@componic.co.nz>> wrote:
> 
>     I created a myfile.m with #include 
> <QtPlatformHeaders/QCocoaNativeContext> and
>     added that to my project.
> 
>     Now I get a compilation error: Qt requires C++11 support
> 
>     Glenn
> 
>     On 1/05/20 9:13 pm, Jean-Michaël Celerier wrote:
>     > Easiest fix may be to rename the file in which you're including that to 
> .mm
>     > instead of .cpp, then clang will treat it as Objective-C++
>     >
>     > Best,
>     > Jean-Michaël
>     >
>     > <http://www.jcelerier.name>
>     >
>     >
>     > On Fri, May 1, 2020 at 2:51 AM Glenn Ramsey <g...@componic.co.nz
>     <mailto:g...@componic.co.nz>
>     > <mailto:g...@componic.co.nz <mailto:g...@componic.co.nz>>> wrote:
>     >
>     >     Hi,
>     >
>     >     I'm wanting to get the native OpenGL context on macOS but when 
> including
>     >     <QtPlatformHeaders/QCocoaNativeContext> I get the following error:
>     >
>     >
>     >     In file included from
>     >     
> .../qt-5.12.7/qtbase/include/QtPlatformHeaders/QCocoaNativeContext:1:
>     >     
> .../qt-5.12.7/qtbase/include/QtPlatformHeaders/qcocoanativecontext.h:1:
>     >     In file included from
>     >   
>      
> .../qt-5.12.7/qtbase/include/QtPlatformHeaders/../../src/platformheaders/nativecontexts/qcocoanativecontext.h:44:
>     >     In file included from
>     >   
>      
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h:8:
>     >     In file included from
>     >   
>      
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKitDefines.h:11:
>     >   
>      
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:492:1:
>     >     error: expected unqualified-id
>     >     @class NSString, Protocol;
>     >
>     >
>     >     Looks like it's including Objective-C stuff that the compiler 
> doesn't
>     like.
>     >
>     >     This is in a Xcode (11.3) project that was created by CMake. How do 
> I
>     make this
>     >     work?
>     >
>     >     Glenn
>     >
>     >     _______________________________________________
>     >     Interest mailing list
>     >     Interest@qt-project.org <mailto:Interest@qt-project.org>
>     <mailto:Interest@qt-project.org <mailto:Interest@qt-project.org>>
>     >     https://lists.qt-project.org/listinfo/interest
>     >
> 
>     _______________________________________________
>     Interest mailing list
>     Interest@qt-project.org <mailto:Interest@qt-project.org>
>     https://lists.qt-project.org/listinfo/interest
> 

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to