Creating a library



  • Hi
    I have the following .pro file
    @
    EMPLATE = lib
    TARGET = CommonUI
    QT += core
    gui
    HEADERS += Internationalisation/LanguageAssistant.h
    SOURCES += Internationalisation/LanguageAssistant.cpp
    FORMS +=
    RESOURCES +=

    CONFIG(debug, debug|release) {
    TARGET = ASLCommonUILibd
    DEFINES += DEBUG
    DESTDIR = $$PWD/debug
    }
    else {
    TARGET = ASLCommonUILib
    DESTDIR = $$PWD/release
    }
    @
    The idea being to generate a library; however, when I build I am getting an undefined reference to main.
    Can anyone please tell me what I am doing incorrectly?

    The generated Makefile.Debug -
    @
    #############################################################################

    Makefile for building: libASLCommonUILibd

    Generated by qmake (2.01a) (Qt 4.8.3) on: Mon 26. Nov 09:26:33 2012

    Project: CommonUI.pro

    Template: lib

    #############################################################################

    ####### Compiler, tools and options

    CC = gcc
    CXX = g++
    DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DDEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NO_DYNAMIC_CAST
    CFLAGS = -g -Wall -Wextra $(DEFINES)
    CXXFLAGS = -g -Wall -Wextra -fno-exceptions -fno-rtti $(DEFINES)
    INCPATH = -I"......\Qt\4.8.3\include\QtCore" -I"......\Qt\4.8.3\include\QtGui" -I"......\Qt\4.8.3\include" -I"......\Qt\4.8.3\include\ActiveQt" -I"debug" -I"......\Qt\4.8.3\mkspecs\default"
    LINK = g++
    LFLAGS =
    LIBS = -L".\lib" -L"c:\Qt\4.8.3\lib" -lQtGuid4 -lQtCored4
    QMAKE = c:\Qt\4.8.3\bin\qmake
    IDC = c:\Qt\4.8.3\bin\idc.exe
    IDL = midl
    ZIP = zip -r -9
    DEF_FILE =
    RES_FILE =
    COPY = copy /y
    SED =
    COPY_FILE = $(COPY)
    COPY_DIR = xcopy /s /q /y /i
    DEL_FILE = del
    DEL_DIR = rmdir
    MOVE = move
    CHK_DIR_EXISTS= if not exist
    MKDIR = mkdir
    INSTALL_FILE = $(COPY_FILE)
    INSTALL_PROGRAM = $(COPY_FILE)
    INSTALL_DIR = $(COPY_DIR)

    ####### Output directory

    OBJECTS_DIR = debug

    ####### Files

    SOURCES = Internationalisation\LanguageAssistant.cpp
    OBJECTS = debug/LanguageAssistant.o
    DIST =
    QMAKE_TARGET = ASLCommonUILibd
    DESTDIR = debug\ #avoid trailing-slash linebreak
    TARGET = libASLCommonUILibd.a
    DESTDIR_TARGET = debug\libASLCommonUILibd.a

    ####### Implicit rules

    .SUFFIXES: .cpp .cc .cxx .c

    .cpp.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

    .cc.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

    .cxx.o:
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

    .c.o:
    $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

    ####### Build rules

    first: all
    all: Makefile.Debug $(DESTDIR_TARGET)

    $(DESTDIR_TARGET): $(OBJECTS)
    $(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)

    qmake: FORCE
    @$(QMAKE) -o Makefile.Debug CommonUI.pro

    dist:
    $(ZIP) ASLCommonUILibd.zip $(SOURCES) $(DIST) CommonUI.pro ......\Qt\4.8.3\mkspecs\features\device_config.prf ......\Qt\4.8.3\mkspecs\features\qt_functions.prf ......\Qt\4.8.3\mkspecs\features\qt_config.prf ......\Qt\4.8.3\mkspecs\win32-g++\qmake.conf ......\Qt\4.8.3\mkspecs\features\exclusive_builds.prf ......\Qt\4.8.3\mkspecs\features\default_pre.prf ......\Qt\4.8.3\mkspecs\features\win32\default_pre.prf ......\Qt\4.8.3\mkspecs\features\debug.prf ......\Qt\4.8.3\mkspecs\features\debug_and_release.prf ......\Qt\4.8.3\mkspecs\features\default_post.prf ......\Qt\4.8.3\mkspecs\features\win32\default_post.prf ......\Qt\4.8.3\mkspecs\features\build_pass.prf ......\Qt\4.8.3\mkspecs\features\warn_on.prf ......\Qt\4.8.3\mkspecs\features\qt.prf ......\Qt\4.8.3\mkspecs\features\win32\thread.prf ......\Qt\4.8.3\mkspecs\features\moc.prf ......\Qt\4.8.3\mkspecs\features\win32\windows.prf ......\Qt\4.8.3\mkspecs\features\win32\stl_off.prf ......\Qt\4.8.3\mkspecs\features\win32\exceptions_off.prf ......\Qt\4.8.3\mkspecs\features\win32\rtti_off.prf ......\Qt\4.8.3\mkspecs\features\resources.prf ......\Qt\4.8.3\mkspecs\features\uic.prf ......\Qt\4.8.3\mkspecs\features\yacc.prf ......\Qt\4.8.3\mkspecs\features\lex.prf ......\Qt\4.8.3\mkspecs\features\include_source_dir.prf HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES

    clean: compiler_clean
    -$(DEL_FILE) debug\LanguageAssistant.o

    distclean: clean
    -$(DEL_FILE) $(DESTDIR_TARGET)
    -$(DEL_FILE) Makefile.Debug

    check: first

    mocclean: compiler_moc_header_clean compiler_moc_source_clean

    mocables: compiler_moc_header_make_all compiler_moc_source_make_all

    compiler_moc_header_make_all:
    compiler_moc_header_clean:
    compiler_rcc_make_all:
    compiler_rcc_clean:
    compiler_image_collection_make_all: qmake_image_collection.cpp
    compiler_image_collection_clean:
    -$(DEL_FILE) qmake_image_collection.cpp
    compiler_moc_source_make_all:
    compiler_moc_source_clean:
    compiler_uic_make_all:
    compiler_uic_clean:
    compiler_yacc_decl_make_all:
    compiler_yacc_decl_clean:
    compiler_yacc_impl_make_all:
    compiler_yacc_impl_clean:
    compiler_lex_make_all:
    compiler_lex_clean:
    compiler_clean:

    ####### Compile

    debug/LanguageAssistant.o: Internationalisation/LanguageAssistant.cpp Internationalisation/LanguageAssistant.h
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\LanguageAssistant.o Internationalisation\LanguageAssistant.cpp

    ####### Install

    install: FORCE

    uninstall: FORCE

    FORCE:

    @


  • Moderators

    @
    EMPLATE = lib
    @

    Should be "TEMPLATE".



  • Hi
    Thanks but that was a c&p error the .pro file does say TEMPLATE


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.