Cannot compile to 32 bit using Matlab Coder
5 views (last 30 days)
Show older comments
Kunal Shitut
on 1 Nov 2020
Commented: Kunal Shitut
on 1 Nov 2020
I am a new Matlab user trying to use the Vision toolbox. I have been trying to compile my matlab program to a 32bit dll from my 64 bit windows machine. Here are the settings that I select:

But I am getting an error as follows:
### Creating dynamic library ".\detectTemplateInImage.dll" ...
link /RELEASE /INCREMENTAL:NO /NOLOGO kernel32.lib ws2_32.lib mswsock.lib advapi32.lib -dll -def:detectTemplateInImage.def `pkg-config --cflags --libs opencv` /nodefaultlib:vcomp -out:.\detectTemplateInImage.dll @detectTemplateInImage_rtw.rsp /LIBPATH:"C:\PROGRA~1\MATLAB\R2020b\bin\win64" "C:\PROGRA~1\MATLAB\R2020b\bin\win64\libiomp5md.lib"
LINK : warning LNK4044: unrecognized option '/-cflags'; ignored
LINK : warning LNK4044: unrecognized option '/-libs'; ignored
LINK : fatal error LNK1181: cannot open input file '`pkg-config.obj'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\link.EXE"' : return code '0x49d'
Stop.
The make command returned an error of 2
Error(s) encountered while building "detectTemplateInImage"
It seems to be an error with OpenCV but I don't know how to solve it exactly. Would greatly appreciate any help.
Thank you
0 Comments
Accepted Answer
Walter Roberson
on 1 Nov 2020
It was possible in R2015b and earlier to compile for 32 bit dll. It is not possible in any release since then.
It looks like you might have other setup problems, but even if you solved those it would not be possible to compile to 32 bits.
3 Comments
Walter Roberson
on 1 Nov 2020
That page is implying that you would not be able to use mingw as the compiler with the libraries that they supply.
The libraries that they supply are 64 bit libraries.
To have a chance with 32 bit you would need 32 bit OpenCV DLLs, either finding them somewhere or compiling yourself.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!