How to use a framework in NetBeans - c++

I'm trying to use a framework in NetBeans (Mac OSX).
The framework is qwt and it resides as qwt.framework in /Library/Frameworks.
To get a project going and using this framework I did two things in project settings:
1) Added a link option '-framework qwt'
2) Added include directory '/Library/Frameworks/qwt.framework/Headers'
This gets thing going, and programmes successfully compile and run, but I'm wondering if this is the correct way to utilise a framework in NetBeans. I guess I was hoping I could just add the framework somewhere, and not have to worry about the includes as they'd be picked up automatically.
Can anyone provide advice on a more efficient/correct way to use a framework in NetBeans?
Thanks
Pete

After doing a bit of google research, it appears there's no simpler way to utilise a framework in NetBeans than do the above steps ie. a) add a link option '-framework xxx' and b) add the include directory from the framework, which resides in xxx.framework/Headers (usually). XCode and QtCreator have options to add a framework directly, but it appears NetBeans doesn't have this option. Hope these steps are useful to someone out there wanting to use NetBeans and frameworks. (I prefer NetBeans over QtCreator to make Qt projects as I find its debugging facilities and general IDE better to use.)
Pete

Related

Import Qt into an existing Xcode project

I am on MacOS 10.13.3, using Xcode 9 as my IDE, and trying to include Qt 5.10 in my Xcode project. I have installed Qt (with docs and examples) with Homebrew and ran many of them in QtCreator. Everything worked well up to this point.
My Xcode project is an extensive, complex project, the development of which has been active for a few years now, so switching to QtCreator or changing the structure of my project is not an option. I really need to add Qt to my existing Xcode project, which IMHO should be quite a natural thing to do given that Qt is a software development framework. However I have not been able to accomplish that yet. The upside is that in the process I have been learning quite a bit about Qt and its ecosystem. I now know how to use qmake, how to set up and successfully compile a project in QtCreator and how to create an Xcode project from QtCreator using qmake. As I said, I have been running many Qt examples and read pretty much every piece of documentation, blog and SO post I could find about this subject. To my surprise I haven't found a direct solution to this problem anywhere on the net.
So far I have included in my Xcode environment QtCore.framework, QtWidgets.framework and QtGui.framework, configured Xcode with the right search paths (Qt finds its files and frameworks) and include the right Qt headers in the code. However upon building my target I get a series of meaningless compilation errors.
Basically - if my understanding is correct - I can't just import Qt's components and frameworks I need, and set the right paths in Xcode just like I would do with any other framework. Qt 'features' a preprocessing step using MOC and UIC that sets it apart from other tools. So I examined the output of qmake and there are two files that the building system produces - qt_makeqmake.mak and qt_preprocess.mak which I think are responsible for the code generation step. Basically this is what I don't know how to translate into my Xcode environment.
Please feel free to tell me if my approach is not correct.
I am open to any advice or suggestion.
I would really like to integrate Qt into my project as Qt is such a powerful and complete framework. I hope someone will be able to help.
Thank you.
1 / In addition to setting the right path to Qt libraries and header files, which is fromwhat you said already done, you need to invoke the moc (Meta-Object Compiler) on your own Qt class which includes the Q_OBJECT macro. (basically every class you have made that are using signal/slot system).
MOChttp://doc.qt.io/qt-5/moc.html
This step must be done BEFORE compiling the project, and the result (the cpp generated moc files) must be compiled AND linked.
Now I am not an expert in XCode and MacOS development but for sure you have a way to add a custom step in your build process for doing that
2/ For UIC files : follow approximatively what is explained here (answer of Preetam, not the one validated) to obtain a .cpp and an .h file that you must include in your project too.
Hope this answer will help and point you toward the rigth direction.
Here is a post explained more in detail what I explained :
https://fmilicchio.bitbucket.io/2013/01/xcode-and-qt4-and-qt5/?

C::B Projet, non necessary files SVN

I am currently developing a software with some partners. We are using Codeblocks to manage the project, and are likely going to be using SVN as a versioning tool.
However, as I already used SVN to work on a report with latex, I'm aware that some files are completely unnecessary.
My question is therefore a little bit broad. How do you think we should proceed using the SVN repository ?
Should we put the C::B project directory directly inside the SVN repository ? (I assume we will have some problem with the project options, as the library are not in the same place for everyone)
Should we put only the source files in the directory and "link" the source files to a codeblocks project outside the SVN repository ? This solution may allow other IDE to be used with the same source files, right ?
Best regards,
Al_th
i think you shouldnt stick to one IDE. Better solution is to create universal build system like Makefile or Cmake. With MakeFile you can easy import project to all decent IDE's.( more of them even support to download project from remote repository)
With universal build system you can use it with your own favourite IDE or even compiler.
I would also consider to change C::B to kdevelop it is fully suporrted with SVN/GIT/Cmake/Make. Also there is support for c++11x.
Isnt it more related to programmers than c++ stackoverflow?

Use Eclipse/CMake with existing C++ project

I have been using Qt Creator as an IDE for some C++ project (non-QT) and I love it. Recently I have been thinking to try out Eclipse mainly for learning a new tool and also the fact that I'm not a big fan of the debugger mode in Qt Creator!
Anyhow, I figured I could potentially use the makefile generated by the qmake, but though hey let's also learn CMake! So, I was wondering if someone could point me to some nice tutorials on this (I have not had much luck myself)? Specifically, I like to have the ability to create and maintain CMakeList.txt files and build/run the project directly within Eclipse ... just as you would by editing a .pro file inside Qt Creator.
Thanks
CMake includes an Eclipse CDT4 generator since version 2.6; you should probably take a look at this page, it explains three different possibilities for using Eclipse and CMake together. From my personal experience, solution 1 works pretty well in Unix environments.

Import existing C++ project into Xcode IDE

I am trying to open an existing C++ open-source library in Xcode to publish it with my own modification/additions. The library is Tesseract-OCR, which does not include a .xcodeproj file.
Since Xcode can function as an IDE, is it possible to open a bunch of files as a single project in Xcode? Is there an easy way to produce an Xcode project?
There are several ways you could do it, depending on the level of IDE integration you want. There's no direct way of importing a Makefile-based project into Xcode. You can create a project that builds via the Makefile, but you wouldn't get many of the benefits of using an IDE, since the editor features such as word completion rely on Xcode being able to parse the files in the project. You will be able to use the debugger though. To do this, create a new project and add a custom target with a script build phase that just calls down to Makefile.
If however the project you're building compiles very easily, ie without requiring a lot of macros to be set up, include paths, etc, then it may be simple to just create an empty project and merely add all source files to it. I've used this method extensively for building boost libraries. If this is a configure && make type project then you will probably have to run the configure step first, and ensure any top level config.h files are included in the project.
If the project has a complex makefile then it is likely to be an involved task to create a useful Xcode project
I realise you asked explicitly for Xcode, but in case you were actually trying to solve the problem of "I have existing C++ code which builds and runs fine from the command line, and I'd like to code and debug it in an IDE, what should I do?" my firm recommendation would be to avoid Xcode and go for Eclipse.
The reason is that as far as I can tell, Xcode has no way of ingesting the command line build environment and effectively requires you to recreate the make process inside Xcode from scratch. Fine for tiny projects, but anything with more than a few source files and it quickly becomes painful. Whereas in Eclipse everything is built around Makefiles. So in my case I got to the "step through code with working code completion" in Eclipse a lot quicker vs. never in Xcode. This of course could be because I'm an Xcode noob, but my 2c.
To create an Xcode project from an existing cmake project, you can run cmake -G Xcode. It produces some folders and files apart from the project file, so it might be better to create a folder for it first. For example:
mkdir -p build/xcode
cd build/xcode
cmake -G Xcode ../..
Xcode is a useable IDE for library creation.
Of course a good first step is to see if the one source code will build on its own with configure scripts that are included.
If not, it becomes a question of how many libraries you need to link in.
There are resources online (or at least there used to be) for using Xcode (or perhaps it's forerunner Product builder) for porting Unix projects to Mac.
Good tutorial at: http://www.macresearch.org/tutorial-introducing-xcode-30-organizer
Another good reference is Darwin Ports.
As for doing this on your own. You can build c++ based libraries in XCode. People do that every day. You can even use one of the Xcode templates to get you started.
However, library dev requires more experience with Xcode then say a simple Cocoa "Hello World" app.
The remaining questions will be assuring that the source code's dependencies are already built into the Mac's SDK. (Don't hold your breath for linking to MFC)
It's a general question... So it's a general answer.
In Xcode8,there is "Xcode->file->add files to...",then choose your files.If you want to add several files at a time,press "Cmd" when you are choosing.

Legacy C++ project using Makefile ..moving to Eclipse IDE?

I have a legacy C++ project on Linux which uses the typical:
./configure
make
make install
to build and install. I would really like to build it instead with an IDE like Eclipse.
Is this doable? Is there something in Eclipse that can parse the original Makefile(s) and turn it into an Eclipse project?
Using Eclipse with the CDT plugin will allow you to use it for C/C++ projects, and you can tell it to use Makefiles to build your project. You just have to set up a Makefile project. You might have to tell it to let you manage the Makefiles rather than have it do it - I don't remember off the top of my head - but there should be no problem in setting up Eclipse to use pre-existing Makefiles to build a pre-existing project. I've done it before.
You will have to tell it where the include directories are and what macros to assume are defined for things like code completion to work correctly (I don't know of any way for Eclipse to figure that out for you), so there is definitely some set up that you'll have to do. But it definitely works.
Just grab the C++ version of Eclipse from their site (it comes with all of the appropriate C/C++ plugins so that you don't have to track them down), and you can look at the CDT site for documentation, frequently asked questions, etc.
Edit: I don't know how well you can get it to work with configure though. That's not something that I've tried. Makefiles work just fine though.
If the project is not too big or too complex. You might do better to just start a new C++ project in Eclipse. Then import the various source and header files into the project.