How do I compile mex with own toolchain?

조회 수: 4(최근 30일)
Jean Matthieu
Jean Matthieu 2023년 1월 24일
답변: Mark McBroom 2023년 1월 30일
My configuration is the following:
Matlab R2020b with toolboxes Simulink, Malab coder, Stateflow, Simulink Coder and Embedded Coder.
I have external manual code library that I want to compile. I want to compile it with my own toolchain that is the qnx 6.5 tooclhain to create a mex library that I can use.
But I have followed all tutorials and still can't understand how to use my own toolchain.
The library I want to mex is called "common". If I don't have mingw64 installed and I type this line
mex -v -IC:/QNX650/target/qnx6/usr/include common.c
--> I have the following error:
Error using mex
No supported compiler was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options, visit
If I have mingw64 and do the same command, it doesn't work because it has a lot of conflicting types between my toolchain QNX and the mingw64 toolchain (see attached file for all errors)
So my question is simple (but maybe the answer is not):
how can I use only my own toolchain to compile my "common" library?
I don't have for qnx a file like intel_tc.m

채택된 답변

Mark McBroom
Mark McBroom 2023년 1월 30일
It sounds like you have some C code that you want to use in MATLAB or Simulink running on a Windows system. If this is correct, then you will need to modify your C code or the .h files included by your C code to remove QNX specific code. You need to use a Windows compiler in order to use the mex function in MALTAB/Simulink running on Windows. A mex function created with QNX toolchain is not usable on a windows computer.

추가 답변(0개)


Find more on Simulink Coder in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by