NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Code Assistance for Qt and CMake from existing sources

 
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users
View previous topic :: View next topic  
Author Message
mryan



Joined: 08 Mar 2017
Posts: 3

PostPosted: Wed Mar 08, 2017 10:46 am    Post subject: Code Assistance for Qt and CMake from existing sources Reply with quote

Hi All,

I'm using NetBeans 8.1 on Mac OSX 10.11 and I used the Qt installer to install Qt instead of compiling from source. I've created a project from existing sources in NetBeans; the project is Qt based but I use CMake to generate the Makefile because I also use VTK in the project.

Everything compiles and executes just fine, but in the editor includes like QWidget are highlighted as unresolved. I can get rid of the red highlighting by pointing the Code Assistance include directories to places like $QTDIR/5.6/clang_64/lib/QtCore.framework/Versions/5/Headers, but I still get warnings telling me that includes in QWidget, such as <QtGui/qwindowdefs.h>, are unresolved. And things like the Q_OBJECT declaration or public slots: are always highlighted as unresolved.

However, if I start a Qt project from scratch, I don't get any of these unresolved highlights.

Is there any way I can configure the correct code assistance in my existing sources project?

Thanks in advance,

Matt
Back to top
soldatov



Joined: 05 Nov 2009
Posts: 597

PostPosted: Wed Mar 08, 2017 4:48 pm    Post subject: Re: Code Assistance for Qt and CMake from existing sources Reply with quote

Can you try NetBeans 8.2? In NetBeans 8.2 "Build analyzer based on tool collection wrapper" feature has been added. On MacOSX (with Clang) a NetBeans 8.1 doesn't know anything about compiler options. In that IDE you can:
- specify compiler options in Project Properties|Code Assistance|C++ Compiler fields (very complex way)
- press "Clean and Buld Project" button on toolbar and press "Configure Code Assistance" button in "Output - project (Clean, Build)" tab (But CMake hides compiler options. I think this way doesn't work in your case.)
- Have you compile_commands.json file (https://cmake.org/cmake/help/v3.8/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html)? If You have this file You needs to call context menu on projects node, select "Code Assistance|Configure Code Assistance..." menu item and select "Explore Build Analyzer Log File" analyzer.
Back to top
mryan



Joined: 08 Mar 2017
Posts: 3

PostPosted: Thu Mar 09, 2017 9:58 am    Post subject: Reply with quote

Thanks soldatov,

I've tried your suggestions but I'm still at the same place. Using 8.2 is slightly better because the build analyser finds the Qt headers automaticaly, but I still get the same warnings about <QtGui/qwindowdefs.h> for QWidget and so on. Q_Object is also still unresolved.

Matt
Back to top
soldatov



Joined: 05 Nov 2009
Posts: 597

PostPosted: Thu Mar 09, 2017 6:37 pm    Post subject: Reply with quote

Can you print full path to qwindowdefs.h file? I think we uses MacOSX frameworks, but NetBeans doesn't like MacOSX specific features.
Back to top
Robert Hartzell
Posted via mailing list.





PostPosted: Thu Mar 09, 2017 6:58 pm    Post subject: Code Assistance for Qt and CMake from existing sources Reply with quote

Quote:
On Mar 8, 2017, at 3:46 AM, mryan <address-removed> wrote:

Hi All,

I'm using NetBeans 8.1 on Mac OSX 10.11 and I used the Qt installer to install Qt instead of compiling from source. I've created a project from existing sources in NetBeans; the project is Qt based but I use CMake to generate the Makefile because I also use VTK in the project.

Everything compiles and executes just fine, but in the editor includes like QWidget are highlighted as unresolved. I can get rid of the red highlighting by pointing the Code Assistance include directories to places like $QTDIR/5.6/clang_64/lib/QtCore.framework/Versions/5/Headers, but I still get warnings telling me that includes in QWidget, such as <QtGui/qwindowdefs.h>, are unresolved. And things like the Q_OBJECT declaration or public slots: are always highlighted as unresolved.

However, if I start a Qt project from scratch, I don't get any of these unresolved highlights.

Is there any way I can configure the correct code assistance in my existing sources project?

Thanks in advance,

Matt



Use Netbeans 8.2 for framework support and try for code assistance includes... literally type {framework} at the end.

$QTDIR/5.6/clang_64/lib/{framework}

Make sure your at the latest release of 5.6 or above to fix problems with the latest Xcode.

hth, Robert.
Back to top
mryan



Joined: 08 Mar 2017
Posts: 3

PostPosted: Thu Mar 09, 2017 8:46 pm    Post subject: Reply with quote

Hi Robert,

Yes, that seems to have done the trick. Thanks a lot!

Matt
Back to top
Robert Hartzell
Posted via mailing list.





PostPosted: Sat Mar 11, 2017 2:53 pm    Post subject: Code Assistance for Qt and CMake from existing sources Reply with quote

Quote:
On Mar 9, 2017, at 1:46 PM, mryan <address-removed> wrote:

Hi Robert,

Yes, that seems to have done the trick. Thanks a lot!

Matt


Glad I could help
Robert
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo