[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mingw-cross-env-list] Cross-compiling a Qt4 project statically linked u

From: Aarón Bueno Villares
Subject: [Mingw-cross-env-list] Cross-compiling a Qt4 project statically linked using a custom Makefile
Date: Fri, 22 May 2015 04:09:20 +0200

Hello everybody,

I've developed a Qt4 application currently working on Linux but I need to cross-compile it for Windows 7 (x86_64), and I use a Makefile instead of qmake. It's the first time I do a cross-compilation, but I have a doubt concretelly in one thing.

I haven't followed yet the tutorial of your website, but I've no troubles with that. It's pretty clear. So, suppose I've reached without problems the step 4.

Since I don't use qmake, I have to follow now the step 5d (using Make) instead of 5c (using qmake), but my doubt is, what about the static linking of Qt?

My original Makefile (summarized) is:
CXXFLAGS=-std=c++11 -pedantic -Wall -pedantic-errors -Wextra
IPATH=-I/usr/include/qt4/ -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql
LDFLAGS=-lQtGui -lQtSql -lQtCore

HEADERS=mymoc1.hpp mymoc2.hpp other-headers

all: myexec

myexec: $(OBJS)
    $(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LDFLAGS)

main.o: main.cpp $(HEADERS)
    $(CXX) -c $(CXXFLAGS) $< -o $@ $(IPATH)

mymoc1.hpp: the-header-needing-moc.hpp
    moc $< -o $@

mymoc2.hpp: other-header-needing-moc.hpp
    moc $< -o $@

Before ask too much thinks, I'll try the solution:

Will the following options

   -Wl,-Bstatic -lQtGui -lQtSql -lQtCore

do the job, or I need to specify also their paths with `-L` options? And in such a case, where are they?

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]