Qt中的编译错误

时间:2012-05-11 06:39:06

标签: c++ qt linker

我正在尝试将我的大项目分解为子目录并将其作为单个可执行文件运行。但是当我执行代码时,它给了我以下错误:

  1. qtmain_win.cpp:-1:错误:未定义引用`qMain(int,char **)'
  2. collect2:ld返回1退出状态
  3. 任何人都可以解释一下这些错误背后的原因......

    提前致谢!!!!

    我制作了一个.pro文件,其中包含了子目录的所有路径。然后每个目录都有自己的.pro和.pri文件,其中包含一个在所有目录中都很常见的目录。该目录是lib。然后是main.pro和main.cpp的main。我在这里粘贴了所有三个文件:Project的专业文件:

    # build all components recursive
    
    TEMPLATE = subdirs
    
    ######## normal build process ########
    #
    # Make sure your Main.pro is in the last line to ensure correct linking!
    #
    SUBDIRS =D:/MultiFuncTester/Modes/Start/Build/Start.pro \
         D:/MultiFuncTester/Modes/MainMenu/Build/MainMenu.pro \
         D:/MultiFuncTester/Modes/Solar/Build/Solar.pro \
         D:/MultiFuncTester/Modes/Main/Build/Main.pro\
    

    CONFIG + = ordered

    Main.pro:

    # ################ include pri file #################
    !include("Main.pri"):error("Main.pri not found")
    
    
    # ################ override some pri settings #################
    TEMPLATE = app
    TARGET = MultiFuncTester
    CONFIG =-static
    QT +=core\
    gui\
    
    
    # ################ own sources #################
    INCLUDEPATH +=D:/MultiFuncTester/
    SOURCES +=../Sources/Main.cpp
    

    Project的pri文件,在所有目录中都是通用的,作为lib

    ######################
    # common stuff for all components
    ######################
    
    TEMPLATE = lib
    
    CONFIG += static \
             warn_on \
             qt \
    
    QT += gui \
          core \
    
    
    INCLUDEPATH +=D:/MultiFuncTester/Modes \
    DEPENDPATH +=D:/MultiFuncTester/Modes \
    
    CONFIG += debug_and_release
    CONFIG += build_all
    
    
    
    CONFIG(debug, debug|release) {
    CONFIG_SUFFIX = dbg
    } else {
    CONFIG_SUFFIX = rel
    DEFINES += QT_NO_DEBUG \
              QT_NO_DEBUG_OUTPUT \
             NDEBUG
    CONFIG(gcov) {
        QMAKE_CXXFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
        QMAKE_LFLAGS_RELEASE += -fprofile-arcs
        QMAKE_CXXFLAGS_RELEASE -= -O2
        QMAKE_CXXFLAGS_RELEASE += -O0
    }
    }
    
    CONFIG(crosstgt) {
    #To be able to build Target run qmake as follows:
    qmake CONFIG+=crosstgt
    CONFIG_SUFFIX = $${CONFIG_SUFFIX}_tgt
    DEFINES += TARGET_BUILD
    }
    
    OBJECTS_DIR = obj_$${CONFIG_SUFFIX}
    MOC_DIR = moc_$${CONFIG_SUFFIX}
    DESTDIR = lib_$${CONFIG_SUFFIX}
    

0 个答案:

没有答案