Using the Qt library in an existing c++ VS2010 program - c++

I'm trying to get the the Qt library to work in an my existing VS2010 project. But I am pretty much stuck.
I have succesuflly compiled the library with nmake on 64 bit and added the Qt adon for vs2010.
But i don't no how to use it in my project, the project makes already use of the boost and the opencv librarys and these work just fine.
I found a thread here on stackoverflow that says I need to edit the vs project file with an text editor but when I do this I cant find the global section that I need to edit.
Can anyone help me with this problem? Thank in advance.

I solved it, wel sort of. I made a new QT project and added my excisting code in the new QT project. I also linked the opencv an boost libs and the application works now!
Thanks for all the comments

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

Connecting pthreadgc2.dll to qt project

I need help with installation pthreads to qt.
the thing is I'm making project with winpcap and pcapplusplus wrapper for it. but it still needs pthreads. I have pthreadgc2.dll missing, and I cant figure out how to connect it to my qt project. Basically, program compiles, but crashes once I try to start it in qt. So, I dont really need the pthread and qthread were distributed with qt, I need exactly these libraries: http://ftp.ntua.gr/mirror/mingw/MinGW/Base/pthreads-w32/pthreads-w32-2.9.1/pthreads-w32-2.9.1-1-mingw32-dev.tar.lzma
but there are no dll files either, and I cant understand how to build project with it.
and yes, I'm sure which dll I need, I checked it with dependency walker, but I dont know where to find it. Hope to your help, folks.
Not all downloadable versions of MinGW work well with pthreads.
There is:
https://sourceforge.net/p/mingw-w64/wiki2/Compile%20pthreads/
that does but I would recommend using TDM-gcc instead, http://tdm-gcc.tdragon.net/.
It is more actively maintained and pthreads work out of the box.
You can then simply link with -lpthread in your linking stage

Qt into ObjectiveC code

As i'am coding in objective-c, i'am wondering if i can put some Qt code in my objective-c project and compile it all together ? i did a research but the answers were kind of shady. If this is possible, do you have a hint or an answer on how to do this please ? Thank you.
It is possible, as I do this the other way round - Use Objective C in a Qt project with Qt Creator. That's easy to do by adding .m or .mm files to the project and linking to the required frameworks.
To add Qt to XCode requires creating a project file from Qt. This post seems to describe steps required to do this.

Can eclipse do auto-complete using external libraries like cocos2d?

I'm using Eclipse in linux. I have created a project using Cocos2D. It's a Java project, but im opening cpp and headers files to write native code.
Each time, i compile the native code with ./build_native.sh
I will like to know if eclipse could be configure to autocomplete functions in native code.
Example:
CCDirector::sharedDirector()->
Must show the options like getWinSize().
Some ideas? Thanks in advance.
I can't answer to the specifics of your question but in general I had this problem in C/C++ with iostream and STL libs. Even though everything would compile fine it wasn't supporting auto-complete. I ended up digging down into the supplied libraries to the root that held each .h file collection and added those to the directories path. Then I rebuilt the index and then auto-complete started working. So if cocos2d stores .h files in more than one location add each folder.
Have you installed the CDT? That give Eclipse C/C++ capabilities similar to what it already has for Java.

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.