Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

VC + + 2008 Express and using the sample compiled Qt Preferences

Published on| May 9th, 2009 | 2 Comments.
In VC + + "Hello world" Let's make the screen
1
2
3
4
5
6
7
8
9
10
11
12
#include "QApplication"
#include "QPushButton"
 
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QPushButton hello("Hello world");
    hello.resize(100, 30);
 
    hello.show();
    return app.exec();
}

The above source code (sample.cpp) Try to compile from the command line.

  1. VC + + 2008 Express SUTATOAPPUMENYU in the "Visula Studio 2008 Command Prompt" opens a

  2. From a command prompt, the directory with the sample source (example) c: \ temp and) to move the current directory to
    1
    2
    
    C:\Program Files\Microsoft Visual Studio 9.0\VC> cd C:\temp
    C:\temp> 
  3. From the command prompt, qmake is run, VC project file for compiling and executing
    1
    2
    3
    4
    5
    6
    7
    
    C:\temp> qmake -project
    C:\temp> qmake temp.pro
    C:\temp> nmake
       :
       : -- コンパイル実施
       :
    C:\temp> 
    Line 1: Automatic search of the source code under the current directory, "the current directory name. Pro" in the name of the Qt project file.

    Line 2: debug, release and create a directory.
    debug, release for MakeFile create.
    - Makefile.Debug, Makefile.Release
    Create a default MakeFile.
    - Makefile

    Line 3: Build implementation
    - By default, debug builds are conducted.
    If you want to build a release version,
    nmake release
    And.
    debug / release version if you want to build together,
    nmake all
    And.

  4. Let us create a running sample.exe please run. When you see the screen below is OK.


The above source code (sample.cpp) to try to compile with the IDE.

  1. VC + + 2008 Express brings up a

  2. IDE environment settings
    [Tools] -> [Optional] -> [Solutions and Projects -> [VC + + directory] -> In the Show directories: [Include files] Add
    • % Qt installation directory% \ Qt \ Include (example: C: \ Qt \ Qt \ include)

    [Tools] -> [Optional] -> [Solutions and Projects -> [VC + + directory] -> In the Show directories: Library files] Add
    • % Qt installation directory% \ Qt \ lib (example: C: \ Qt \ Qt \ lib)

  3. MakeFile Empty Project (Sample) to create the menu [File] - [New] - [Projects] Click.

    Left: whole, right of the screen: Select the MEIKUFAIRUPUROJEKUTO.


  4. Nmake project will change the way
    [Project] -> [Properties] -> [Configuration Properties] -> [Nmake] Open the.

    The following describes the command line.
    qmake-project
    qmake
    nmake debug
    Once entered, click OK.
    ※ The last line, release version, "nmake release" is specified.
    A line "qmake-project-t vcapp-o hello.pro" as the project name (hello.pro) can also be specified.
    If so, then change the file name to run hello.exe.
    Here, so the same command line, and then continued to explain.
    Note:
    KURINKOMANDORAIN is, "nmake debug-clean" look like.


    $ (ConfigurationName) \ vcsample.exe as by default, is specified only the file name, "$ (ConfigurationName) \" I'll have it before.
    The executable file is "sub-directory name. Exe" and it warned.
    ※ Qt together I'll spit in the Makefile.

    ※ In the same manner, release and then specify how to build.


  5. Sample.cpp used in the first copy, and then added to the project
    - Sample.cpp file, the directory must be directly under this project.

  6. Please try to build implementation
    --- Sample.exe is OK when you created.

  7. Let us create a running sample.exe please run. When you see the screen below is OK.



    When running with the IDE and must display the following screen.
    This should probably be ignored.


    Screen above,
    [Tools] -> [Optional] -> [Solutions and Projects -> [Build / run] -> At runtime, when the old form of the project:
    • Always build
    • Not built
    And either will not be output.
    If one wants to restore the "confirm build" if set to return to the original.

    Advantages of using the IDE and debug it.
    The debug version is, of course, debugging (break).
    Following the break, you can also look into the details.


IDE settings, each time you build to be done, qmake does not need to run.
If there are changes to the project, I can run, we often forget, and to run with each build.
In addition, we have not verified the details, but no problem if the source code under the directory will be a problem if it is different. Furthermore, when you want to set up a separate lib and add the path, and has many problems.

Articles: qmake with VC + + 2008 Express to create a project file

To create an environment, the author, was an all-day.
If you are reading this article, but a little, I would be in time.
Indeed, how can you think so, still, nothing to do with IEMASEN, from the amount of source code, Qt is fine, I was able to feel less.

For reference, release version of the optimization, O2 (running speed) is used.
File Size of the sample run: 8K
※ SERUU for it to work, MFC Similarly, Qt must not distribute the DLL with the.

Qt: QTGUI4.DLL (7MB), QTCORE4.DLL (2MB), msvcrt? ? . dll (0.3MB)
MFC: mfcxx.dll (1MB), msvcpxx.dll (0.5MB), msvcrxx.dll (0.4MB), msvcrt? ? . dll (0.3MB)

The distribution is only slightly larger?

Comments

2 Comments. “VC + + 2008 Express and using the sample compiled Qt Preferences”


  1. nota
    April 23rd, 2011 @ 07:41:22

    こんにちは
    QT Creatorを使用して間もないのでこのサイトはとても参考にさせていただいております。
    現在、dllを外部参照させようと文献をあさったり検索したりしているのですが、なかなか情報が少なく上手くいっておりません。お手数ですがお教えいただければ幸いです。
    よろしくお願い致します。

  2. master
    April 26th, 2011 @ 23:46:32

    基本的なクラスなら QLibrary で Win32 のLoadLibrary と同じことができた?と思いますよ。
    (プラグインのような)動的リンクをするができたと思います。

    DLL側は、QT Creatorで C++ライブラリ作成 – 共有 でプロジェクトを作成するとOK?だったと思います。

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ