How do I compile mex with own toolchain?
4 views (last 30 days)
Show older comments
Jean Matthieu on 24 Jan 2023
Answered: Mark McBroom on 30 Jan 2023
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 on 30 Jan 2023
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.
More Answers (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!