[Moved] Trouble migrating code from VS2008 to Qt
-
Hi, i'm new in Qt and I have this problem.
I developed a C++ program using Visual Studio 2008, I use OpenGL for graphics and GLUI for user interface.
I would like to use Qt for user interface because it seems to be easier and it looks better than GLUI.
My program uses a .lib for solving a numerical problem (arpack++), so I have some .h and some .libs besides
my own .h and .cpp files.
So, I created a new proyect, I added the .h and .cpp files and I modified the .pro file for writting the LIBS+= instruction.
When I compile the program I get a lot of compile errors like this one:
C:/Documents and Settings/Administrator/Desktop/System/././ARPACK++//arrseig.h:22: error: new.h: No such file or directoryarrseig.h is a .h file form arpack++ dll and it work fine in VisualStudio (they are the same files, without modification),
and new.h should be included in Qt (it is a .h file that comes with c++).Does someone knows if I shoul include something or configure something such that Qt can use the c++ default headers????
Please help me , I've spend a week trying to solve this problem....
THANKS!!!!!I'm using Qt Creator 1.3.0
Based on Qt 4.6.0 (32 bit)
Built on Nov 27 2009 at 14:53:38
From revision c0e849ecc3
Copyright 2008-2009 Nokia Corporation. All rights reserved.
In windows XPEdited: it's Qt, not QT, and don't SHOUT. peppe
-
Hello,
I am not a .pro file expert, so I cannot help you with this manual config.
However, you can still use MSVC2008. There is a "plugin":http://qt.nokia.com/downloads/visual-studio-add-in that might help you.
Also, since you are starting with Qt, avoid edititing .pro files, instead create Qt applications from inside Visual Studio 2008 with the plugin installed, this way the project created will contain everything you require from Qt, after few check box configurations. Then, you will be able to clone some of the config from your previous msvc project, just copy/paste.However, if you still need to leave MSVC, I recommend that you use "Qt Creator":http://qt.nokia.com/downloads which is also user friendly. Not an expert on that too, but some people here like it.
Take a look at the documentation, they really helped me to getting started with Qt :-)
Good Luck!
Regards -
Complementing:
This lib shouldn't be a problem at all.
QtSDK can install the Qt VS2008 build for you (check that during install), and it will be in the Desktop folder. Something like: C:\QtSDK\Desktop\Qt\4.7.3\msvc2008 -
[quote author="VitorAMJ" date="1313523121"]
However, you can still use MSVC2008. There is a "plugin":http://qt.nokia.com/downloads/visual-studio-add-in that might help you.
Also, since you are starting with Qt, avoid edititing .pro files, instead create Qt applications from inside Visual Studio 2008 with the plugin installed, this way the project created will contain everything you require from Qt, after few check box configurations. Then, you will be able to clone some of the config from your previous msvc project, just copy/paste.
[/quote]
Exactly what I'd recommend! -
Adding to the LIBS variable is not enough. This just adds the neede libraries to the links phase of the build.
You need to add the path to the include files to the INCLUDEPATH variable of the .pro file (or add one, if it is not yet present).
Regarding Qt Creator: I can recommend it, I like it over MSVC. It is not a compiler or the like, though. It just calls qmake and make/nmake behind the scenes and uses .pro files as its primary project files.
-
Thank you all for your answers, I was googling and I found a comment that said that it should be
written #include <new> instead of #include <new.h> and doing that I solved that error.
But now, I got 500 new errors of variables and methods that "was not declared in this scope". It's true that
those variables were not declared in the .h file where the error is indicated, but they are declared in the .h
files defined in the #include.
I'm almost giving myself up with QT. I thought it was gonna be easier.Can someone help me?????
-
That is a compiler issue you are experiencing, not a Qt issue.
You seem to be confusing VC and Qt for things they are not:
Qt is an application framework, written in C++
VS is an IDE and a toolchain with compiler.
You can use the second to build the first, and you can use the second to build applications based on the first. But you can also use another IDE and/or compiler toolchain to do these. To complicate matters, Qt comes with its own IDE (QtCreator), but not with its own compiler toolchain (though GCC/MinGw is installed with the Qt SDK by default).
To complicate matters a bit more yet, Qt comes with its own build system called qmake, which is basically a project file format. However, you are not obliged to use it. You can also use something else (like CMake, or VS solution files). These qmake files don't do the actual building, they can just be used to generate makefiles or VS solutions.
-
Please, take it easy :-) . Follow the links I passed to you. Install the VS2008 Qt Desktop version from QtSDK (if they are not already installed, you can do that executing C:\QtSDK\SDKMaintenanceTool.exe).
Install Selected Components > Development Tools > Desktop Qt > 4.7.3 > MSVC 2008Then, point the environment variable of windows called QTDIR to the msvc2008 build you have just installed. If there is no System Variable called QTDIR you will need to create one, so go to Windows start/symbol in the lower left of your desktop, right-click Computer and select properties. then select Advanced system settings, and then Environment variables. Set it to your QtSDK Qt Desktop, something like:
C:\QtSDK\Desktop\Qt\4.7.3\msvc2008Then, install the Qt Visual Studio Add-in available in the link I have just posted to you. After that, see if you have a Qt menu option inside your Microsoft visual studio 2008. When you succeed to doing that, post us again, that we will provide further help.