Building qt with acados

Hi everybody,

I am using the acados library for my thesis project, which comprises a hardware that communicates with my laptop via USB. This hardware is to be controlled through MPC. The choice is to use a state machine in qt which includes some of the acados header files (basically the same ones which are present within the main.c file generated from the Matlab interface).

So far I was able to generate the c code from Matlab and to compile it from Matlab with the file ‘compile_main.m’ (or directly from the cmd line simply typing ‘mingw32-make.exe’).

My main issue is how to build the qt file: in order to implement the ocp solver within the file ‘controllermpc.cpp’, which is used by the qt file, I must indeed include the following acados header files:

// acados
#include "acados/utils/print.h"
#include "acados/utils/math.h"
#include "acados_c/ocp_nlp_interface.h"
#include "acados_c/external_function_interface.h"
#include "acados_solver_demo.h"

I tried to modify the #include “…” by specifying the full path, however these header files refer to other header files and I shoud modify them as well,.This method would be very cumbersome and error-prone.

The qt file, which includes two cpp files (‘controllermpc.cpp’ and ‘main.cpp’) is as follows:

QT -= gui
QT += statemachine widgets

CONFIG += c++11 console
CONFIG -= app_bundle

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

        controllermpc.cpp \

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target


Therefore, my question is how to include the acados header files previously mentioned in the most proper way.

Thanks a lot for the developed library and for your help with our issues.


I think it should be possible to include the header files similarly to how is done in the generated Makefile.