The daily ramblings …

HOWTO install Qt and Coin3D on Win32

Posted in Programming by akamal on February 13, 2007

Merging C++ with 3D visualization is always a big issue to most people, especially because standards don’t simply exist, and no single GUI library that corresponds seamlessly with 3D library. Some might prefer open source solution, but this usually requires him (or her) to put up with cumbersome tasks of compiling, building, error detection, never-ending problems with no solution.

I deal with lots of 3D development especially since I am required to come up with scientific visualization and interpretation of data. I had all sorts of trouble initially when trying to build one integrated approach. Well, I am going to write here a one in all documentation on how to install QT, Coin3D using only free software, yes you heard me, you don’t have to fork out a single cent, save your monthly internet bill.

So, if you’re interested on development of QT and 3D graphics, open inventor-like approach, this is the right place for you to start!

UPDATE 3/3/2007
I have included installation guide on qwt (QT widgets for Technical Application), especially for those of you who wants to use qt for scientific applications. So far, I have also modified this article, where the previous ones did not include things like set up of environment variable QMAKESPEC. So, happy installing!

BASIC REQUIREMENTS

What you need to download are listed below:

Software Library Version File Name Website URL
Qt 4.2.2 (source) qt-win-opensource-src-4.2.2.zip http://www.trolltech.com/developer/downloads/qt/windows
Coin 3D 2.4.5 (source) Coin-2.4.5.zip http://www.coin3d.org/lib/coin/releases
SoQt 1.4.1 (source) SoQt-1.4.1.zip http://www.coin3d.org/lib/soqt/releases
Q../Free 4.2.2 acs-4.2.2-patch1.zip http://sourceforge.net/project/showfiles.php?group_id=49109
Visual C++ 2005 Express Edition 2005 msvc2005.exe http://msdn.microsoft.com/vstudio/express/visualc/download/
Microsoft Platform SDK 2003 SP1 PSDK-X.cab (around 13 files) http://www.microsoft.com/downloads/details.aspx?
familyid=EBA0128F-A770-45F1-86F3-7AB010B398A3&displaylang=en
QWT 5.0.1 qwt-5.0.1.zip http://sourceforge.net/project/showfiles.php?group_id=13693&release_id=489512

GENERAL INFORMATION

First make sure everything is installed / unzipped under 1 directory, e.g: D:\devel\. So you will deal with stuff under one roof. It’s not really necessary, but I find it rather easy to manage.

d:\devel\coin-2.4.5
d:\devel\qt-4.2.2
d:\devel\soqt-1.4.1
d:\devel\msdk
d:\devel\vc_express

Use the Visual C++ 2005 command prompt; instead of the normal command window cmd.exe (This will be available once you install Visual C++ 2005). Reason for this? We want to use the nmake feature.

All the steps listed below MUST be strictly performed in its outmost respect! Do not miss even 1 step, as failure to do so will cause you headache and tendency to throw things to the front yard! You’ve been warned!

STEP 1 : INSTALLATION OF VISUAL C++ EXPRESS EDITION & MS PLATFORM SDK

Install Visual C++ Express Edition first. Just normally follow through the steps and there’ll be downloads to be done while installing.

When the VC Express setup is complete, install Microsoft platform SDK next. Depending on the file type you download, you will either have lots of .cabs file with extract.exe, or simply just an ISO file. I recommend downloading the one with lots of .cabs file (Make sure you download everything listed in that webpage).

If you download the .cabs files, then open up msvc2005 command prompt and type

>> Psdk-full d:\devel\msdk

Note: You must set Internet Explorer to default web browser as the installation requires activeX.
Read the instruction provided by Microsoft Platform SDK readme website, and install all SDK! That means when the setup page asks you what to install, just click Windows SDK, by default, all SDK will be installed.

After installation of MSDK is completed, you’re required to tweak a little on msvc2005 settings. Read through below:

Launch Microsoft Visual C++ Express Edition.
Click Options > Projects and Solutions > Visual C++ Directories:
Add the lines below:
Executable files: d:\devel\msdk\Bin
Include files: d:\devel\mdsk\Include
Library files: d:\devel\msdk\Lib

Update the corewin_express.vsprops file based on instruction below:

Open the file which resides in d:\devel\vc_express\VC\VCProjectDefaults\ corewin_express.vsprops
Change the string that reads:
AdditionalDependancies=”kernel32.lib” to
AdditionalDependancies=”kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib”

STEP 2 : INSTALLATION OF QT 4.2.2 AND ITS QT PATCH

Unpack / unzip the qt-4.2.2-src file to a directory, e.g d:\devel\ so it will become d:\devel\qt-4.2.2 .

Then unzip the qt patch file (acs-4.2.2-patch1.zip) and put all the content inside qt-4.2.2 folder.

Run installpatch42.bat by clicking on it, or typing it at the command line.

Now inside folder qt-4.2.2, from the vc2005 command prompt, type qconfigure.bat msvc2005 (DO NOT use the provided configure.exe file at all)

Just press yes to everything, sit back and relax while the installation proceeds.

STEP 3 : ENVIRONMENT CONFIGURATION

Right click at My Computer > Properties > Advanced > Environment Variables

Add new variables QTDIR and QMAKESPEC under user variables:

Variable name : QTDIR
Variable value : d:\devel\qt-4.2.2

Variable name : QMAKESPEC
Variable value : win32-msvc2005

Edit path variable by adding below value:
%QTDIR%\bin

Configure msvc2005 settings, by aunching msvc2005, then click Option Tools > Options dialog box.

Add all directories listed under QTDIR\include to Include files. (YES, ALL!)

d:\devel\qt-4.2.2\include\ActiveQt
d:\devel\qt-4.2.2\include\Qt
…. and so on

Add all directories listed under QTDIR\lib to Library files.

STEP 4 : INSTALLATION OF COIN 3D

Unzip Coin-2.4.5.zip to let’s say, d:\devel\Coin-2.4.5 .

Create an environment variable COINDIR with value d:\devel\Coin-2.4.5 (similar to method in STEP 3).

Now go to d:\devel\Coin-2.4.5\build\msvc8, and launch Coin2.sln (a vc solution file). Visual C++ 2005
will be launched with the solution / project opened.

Click Build > Configuration Manager under the toolbar. Then change the value in Active Solution Configuration to DLL (RELEASE).

Now click on Build > Build Solution. Just wait for it to compile and complete.

STEP 5 : INSTALLATION OF SOQT

Unzip SoQt-1.4.1 to let’s say d:\devel\SoQt-1.4.1 .

Inside folder SoQt-1.4.1, go to \build\msvc8\ and launch soqt1.sln (a vc solution file). Visual C++ 2005 will be launched with the solution / project opened.

Click Build > Configuration Manager under the toolbar. Then change the value in Active Solution Configuration to DLL (RELEASE).

Now click on Build > Build Solution. Just wait for it to compile and complete.

STEP 6 : INSTALLATION OF QWT

Extract qwt.zip.

Use msvc2005-command prompt to create project qwt file. Do this by typing :
>> // Change directory to qwt dir
>> qmake qwt.pro
>> nmake

If you followed everything correctly up till now, then you should not have any problem. Notice that several files will be built under qwtdir\lib, namely qwt.dll and qwt.lib.

STEP 7 : HOW TO USE QT IN MSVC2005

Here are the basic steps listed below:

Create a qt file, maybe named qt_test.cpp and then store it in a newly created project directory, let’s say directory qt_test.

Next, launch msvc2005-command-prompt, go to the directory which contains the file.

>> qmake -project -t vcapp
>> qmake

This will generate a .vcproj file, which is a project file for msvc2005. You can then open it, and run and work in msvc2005.

STEP 8 : HOW TO USE QWT IN MSVC2005

If you have built it, then proceed with adding qwt path for /lib and /src to msvc2005.

To do that, in msvc2005, click Tools > Options > Projects and Solution > VC++ Project Directories and add below values:

Include Files : qwtdir\src
Library Files : qwtdir\lib

Now create or load a qwt based project, and when you already done that, add preprocessor definition QWT_DLL to your project’s preprocessor list. To do that, follow below:

Click Project > project properties > Configuration Properties > C/C++ > Preprocessor. Add QWT_DLL to the list of Preprocessor Definitions.

Advertisements

9 Responses

Subscribe to comments with RSS.

  1. Bob Matthews said, on December 12, 2007 at 5:54 pm

    Hello Ahmad
    Thank’s for these instructions………….
    but I’ve stumbled on Step 2
    ———————————–
    project.cpp(42): fatal error C1083: cannot open include file: ‘Windows.h’: no such file or directory
    project.cpp(650): fatal error C1083: cannot open include file: ‘Windows.h’: no such file or directory
    nmake: fatal error V1077 ‘C:\devel\vc_express\vc\BIN\c1.exe’: return code ‘0x2’
    Stop.
    ————————————————
    Any ideas on what I may have done wrong?
    Thank’s

  2. Bruci said, on December 14, 2007 at 2:29 am

    Yeah, I always have a problem at step 2.

    I’m using MS Visual Studio 2005 btw.

    link /NOLOGO /SUBSYSTEM:CONSOLE /incremental:no /OUT:”..\bin\qmake.exe”
    @C:\Users\Danh\AppData\Local\Temp\nmAE11.tmp
    metamakefile.obj : error LNK2019: unresolved external symbol “public: __thiscall
    DspMakefileGenerator::DspMakefileGenerator(void)” (??0DspMakefileGenerator@@QAE
    @XZ) referenced in function “public: static class MakefileGenerator * __cdecl Me
    taMakefileGenerator::createMakefileGenerator(class QMakeProject *,bool)” (?creat
    eMakefileGenerator@MetaMakefileGenerator@@SAPAVMakefileGenerator@@PAVQMakeProjec
    t@@_N@Z)
    ..\bin\qmake.exe : fatal error LNK1120: 1 unresolved externals
    NMAKE : fatal error U1077: ‘”C:\Program Files\Microsoft Visual Studio 8\VC\BIN\l
    ink.EXE”‘ : return code ‘0x460’
    Stop.

  3. Fez said, on January 31, 2008 at 9:36 am

    im having the same prob as bruci…is there any solution to that?

  4. Swetha said, on April 11, 2008 at 7:51 am

    Hi Ahmad Kamal Azmi,

    I need your help. Iam facing issues while installating COIN3D, QT.
    Below is the error iam getting. I have followed all the steps as per your website.

    project.cpp(42): fatal error C1083: cannot open include file: ‘Windows.h’: no such file or directory
    object.cpp(650): fatal error C1083: cannot open include file: ‘Windows.h’: no such file or directory
    NMAKE: fatal error U1077 ‘C:\devel\vc_express\vc\BIN\c1.exe’: return code ‘0×2

    Please give me some information. i have been stuck in the same place for many days.

  5. Lukas said, on April 11, 2008 at 8:09 pm

    Hi, do You have any hints for Dev-Cpp users regarding qwt?
    I’ve compiled the distribution (qwt-5.0.2) with mingw on win32 platform, it works fine with CodeBlocks IDE, but Dev seems not to see the compiler flag QWT_DLL. Any suggestions?

  6. akamal said, on April 12, 2008 at 2:31 am

    Hi first of all, thank you guys for visitng my site and making use of the tutorials I compiled.

    On the windows.h problem, I forgot to mention in the tutorial that you MUST INSTALL ALL MODULES UNDER MICROSOFT SDK platform, don’t leave out even one module.

    My recommendation is to uninstall the microsoft sdk and start reinstalling it in full force. Hope this help guys 🙂

    On Lukas, I apologize but I’m not pretty sure the setup for qwt with dev cpp. But I’ll check around with my frens (some of em dev cpp users) if they know of such things.

  7. scott said, on April 18, 2008 at 2:55 am

    I got everything working.. except when i try to compile an example from the sample code from coin3d website.it keeps giving me the following error.. i tried a number of times.. just cant fix it . any help?

    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: void __thiscall SoBase::unref(void)const ” (__imp_?unref@SoBase@@QBEXXZ) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: static void __cdecl SoQt::mainLoop(void)” (__imp_?mainLoop@SoQt@@SAXXZ) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: static void __cdecl SoQt::show(class QWidget * const)” (__imp_?show@SoQt@@SAXQAVQWidget@@@Z) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __thiscall SoQtExaminerViewer::SoQtExaminerViewer(class QWidget *,char const *,int,enum SoQtFullViewer::BuildFlag,enum SoQtViewer::Type)” (__imp_??0SoQtExaminerViewer@@QAE@PAVQWidget@@PBDHW4BuildFlag@SoQtFullViewer@@W4Type@SoQtViewer@@@Z) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __thiscall SoCone::SoCone(void)” (__imp_??0SoCone@@QAE@XZ) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: void __thiscall SoMFColor::setValue(class SbColor const &)” (__imp_?setValue@SoMFColor@@QAEXABVSbColor@@@Z) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __thiscall SbColor::SbColor(float,float,float)” (__imp_??0SbColor@@QAE@MMM@Z) referenced in function _main
    1>test.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: __thiscall SoBaseColor::SoBaseColor(void)” (__imp_??0SoBaseColor@@QAE@XZ) referenced in function _main

  8. Srichand said, on May 13, 2008 at 7:36 am

    Hi kamal,

    Well i got stuck with installing qwt plugin in MSVC-2005..
    I checked all the possible ways to solve this but failed…
    Even i checked ur process which u mentioned above… but no sign of result.

    finally.. what i need is i need to work on graphs, plots which are possible only through qwt.5.0.2 ..
    can u help me out in this case…

    with regards..
    srichand

  9. teakholz gartenmöbel said, on March 7, 2011 at 10:26 am

    ya, attentive transmit ans some suitable points of view


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: