Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) StaticLibraryQtCreatorExample1

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./CppStaticLibraryQtCreatorExample1/CppStaticLibraryQtCreatorExample1Application.pro

 

QT       += core
QT       -= gui
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

!exists(../build-CppStaticLibraryQtCreatorExample1Library-Desktop_Qt_5_1_1_MinGW_32bit-Debug/debug/libCppStaticLibraryQtCreatorExample1.a) {
  error(Could not find correct path to built library)
}

LIBS += ../build-CppStaticLibraryQtCreatorExample1Library-Desktop_Qt_5_1_1_MinGW_32bit-Debug/debug/libCppStaticLibraryQtCreatorExample1.a

 

 

 

 

 

Qt project file: ./CppStaticLibraryQtCreatorExample1/CppStaticLibraryQtCreatorExample1Library.pro

 

QT       -= core gui
TARGET = CppStaticLibraryQtCreatorExample1
TEMPLATE = lib
CONFIG += staticlib
SOURCES += cppstaticlibraryqtcreatorexample1.cpp
HEADERS += cppstaticlibraryqtcreatorexample1.h
unix:!symbian {
    maemo5 {
        target.path = /opt/usr/lib
    } else {
        target.path = /usr/lib
    }
    INSTALLS += target
}

 

 

 

 

 

./CppStaticLibraryQtCreatorExample1/cppstaticlibraryqtcreatorexample1.h

 

#ifndef CPPSTATICLIBRARYQTCREATOREXAMPLE1_H
#define CPPSTATICLIBRARYQTCREATOREXAMPLE1_H


class CppStaticLibraryQtCreatorExample1
{
public:
  CppStaticLibraryQtCreatorExample1();

  void SayHello();
};

#endif // CPPSTATICLIBRARYQTCREATOREXAMPLE1_H

 

 

 

 

 

./CppStaticLibraryQtCreatorExample1/cppstaticlibraryqtcreatorexample1.cpp

 

#include "cppstaticlibraryqtcreatorexample1.h"
#include <iostream>

CppStaticLibraryQtCreatorExample1::CppStaticLibraryQtCreatorExample1()
{

}

void CppStaticLibraryQtCreatorExample1::SayHello()
{
  std::cout << "Hello\n";
}

 

 

 

 

 

./CppStaticLibraryQtCreatorExample1/main.cpp

 

#include "cppstaticlibraryqtcreatorexample1.h"

int main()
{
  CppStaticLibraryQtCreatorExample1().SayHello();
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml