Hi
I compile Qt based hal components all the time, which contain multiple
C++ files and headers, so use a .pro file to create a Makefile
This is an example, with all the basic defines and libs, you will need
to adapt to your specific paths
TEMPLATE = app
TARGET = qtvcp
DEPENDPATH += .
QMAKE_CXXFLAGS += -D_FORTIFY_SOURCE=0 -D_GNU_SOURCE -DULAPI -mhard-float
-fno-fast-math -mieee-fp -fno-unsafe-math-optimizations
-Wframe-larger-than=2560 -Os -std=c++0x
INCLUDEPATH += . /usr/include usr/include/linux
/usr/src/machinekit/include /opt/Qt/5.3/gcc/include
/opt/Qt/5.3/gcc/include/QtDesigner
QMAKE_LIBDIR += /lib /usr/src/machinekit/lib
/opt/Qt/5.2.1/gcc_64/plugins/designer
LIBS += -llinuxcncini -llinuxcnchal -lnml -llinuxcnc -lposemath
-lhalwidgets_qt5
QT += core gui widgets
# Input
HEADERS += qtvcp.h HAL_Access.h NML_Access.h
FORMS += qtvcp.ui
SOURCES += main.cpp qtvcp.cpp qtvcp_funcs.cpp qtReceive.cpp
HAL_Access.cpp HAL_Access_Local.cpp NML_Access.cpp
NML_Access_Machine_Commands.cpp
Alternately, doing commandline compilation of components based on a C
file looks something like this
gcc -Os -g -I. -I/usr/realtime/include -I.
-I/usr/src/linuxcnc-dev-rtai/include -I/usr/include/modbus \
-D_FORTIFY_SOURCE=0 \
-mhard-float -DRTAI=3 -fno-fast-math -mieee-fp
-fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime \
-D_FORTIFY_SOURCE=0 -D__MODULE__ -I/usr/include/linuxcnc
-Wframe-larger-than=2560 -URTAPI -U__MODULE__ -DULAPI -Os \
-o {output file name} {filename.c} -Wl,-rpath,/lib -L/lib
-L/usr/lib -L/usr/src/linuxcnc-dev-rtai/lib -llinuxcnchal -llinuxcnc
-lmodbus ;;
(This of course was for linuxcnc on 10.04)
Between the 2 you should get a picture of the includes, defs and libs
required and adapt accordingly
regards