View Full Version : using a third party Makefile

15th October 2013, 08:27
I am trying to develop a Qt Widget GUI based application.
I already have a console based application with a Makefile and now want to make some changes to make it a button driven application.
My makefile is as follows:

# Makefile for Basler Pylon sample program
.PHONY : all clean

# the program to build
NAME := Grab

# Build tools and flags
CXX := /usr/bin/g++
LD := /usr/bin/g++
CPPFLAGS := -I$(GENICAM_ROOT_V2_1)/library/CPP/include \
CXXFLAGS := -g -O0 #e.g., CXXFLAGS=-g -O0 for debugging

# To keep the makefile for 32 and 64 in sync we add 64 and 32-bit library paths
# If you are targeting only 32 bit for you can remove the entries containing "64"
LDFLAGS := -L$(PYLON_ROOT)/lib64 \
-L$(PYLON_ROOT)/lib \
-L$(GENICAM_ROOT_V2_1)/bin/Linux64_x64 \
-L$(GENICAM_ROOT_V2_1)/bin/Linux64_x64/GenApi/Generic \
-L$(GENICAM_ROOT_V2_1)/bin/Linux32_i86 \
-L$(GENICAM_ROOT_V2_1)/bin/Linux32_i86/GenApi/Generic \
LIBS := -lpylonbase

all : $(NAME)

$(NAME) : $(NAME).o
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) -lGCBase_gcc40_v2_1

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

clean :
$(RM) $(NAME).o $(NAME)

I have set the IncludePath in my pro file as:

INCLUDEPATH += /opt/pylon/include \

Can someone tell what other settings i need to make in my .pro file to make it work

I am using Ubuntu 12.04 32-bit desktop edition using QTCreator 2.4.1 (based on QT 4.8.0 32-bit)

15th October 2013, 10:29
Why do you want to modify the Makefile ? With Qt you need to play with .pro files.

As far as your problem is concerned, you will need to add QT += gui in your .pro file. Or remove the QT -= gui from the pro file of your console application ( in case you are modifying the console application itself to a gui application )

15th October 2013, 10:55
I do not want to modify my Makefile,just want to know how to add libraries and LD_FLAG path to my .pro file.
I already have Qt+= gui in my .pro file.
Here is the complete .pro file:

QT += core gui

TARGET = abc

INCLUDEPATH += /opt/pylon/include \
SOURCES += main.cpp\
mainwindow.cpp \
hellothread.cpp \

HEADERS += mainwindow.h \

FORMS += mainwindow.ui



16th October 2013, 07:38
Use LIBS += etc.
If you are using Qt Creator, right click on your project and click add library.. that will guide you with your library. Don;t make changes to makefile if you are using qmake.
Makefile is generated and will overwrite all changes you have made to it.