Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating a library
Forum Updated to NodeBB v4.3 + New Features

Creating a library

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    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:

    @

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @
      EMPLATE = lib
      @

      Should be "TEMPLATE".

      (Z(:^

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GrahamL
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved