User forums > Using Code::Blocks

Code::Blocks +GCC64 + MATLAB


Dear Friends,

I hope this message finds you well. I am writing to seek guidance on configuring Code::Blocks for the compilation of Pure C source code, specifically with the inclusion of the "engine.h" header file. I am a dedicated user of Code::Blocks and have come to appreciate its versatility; however, I am aware that integrating such components has posed challenges in the past.

Could you kindly provide instructions or insights on how to set up Code::Blocks to compile Pure C source code while incorporating the necessary "engine.h" header file? Additionally, I am interested in understanding how to compile source code that is linked to MATLAB for seamless integration. Any guidance or best practices you can share in this regard would be greatly appreciated.

Thank you in advance for your assistance, and I look forward to your response.

Warm regards,

Link to wiki page
Link to this website rules,9996.0.html

I suggest posting your compiler information if you cannot figure what is needed to set it up in Code::Blocks.
Location/Path installed?
Where compiler was downloaded from?

Tim S.

My compiler is MSYS2 downloaded from official site, updated.
The code is simple
#include <stdio.h>
#include <stdlib.h>
#include <engine.h>

int main() {
    Engine *ep;
    mxArray *result = NULL;

    if (!(ep = engOpen(NULL))) {
        fprintf(stderr, "No MATLAB Engine\n");
        return 1;

    engEvalString(ep, "x = 5; y = x^2;");

    result = engGetVariable(ep, "y");
    if (result) {
        double *data = mxGetPr(result);
        printf("Square: %lf\n", data[0]);


    return 0;
The settings are "Compiler - Search directories - Compiler - C:\Program Files\MATLAB\R2022a\extern\include\"
"Compiler - Search directories - Linker - C:\Program Files\MATLAB\R2022a\extern\lib\win64\mingw64\"

So, I am guessing you have no toolchain setup problem; since you failed to post the information needed to setup CB to use the Compiler.

Edit: I have no idea how to use MATLAB; but, the MATLAB directions suggested only a certain version of the MINGW compiler are supported.

Tim S.


[0] Message Index

Go to full version