C++ to Matlab rc.exe 64-bit o/s

8 views (last 30 days)
I'm trying to compile a 64-bit Matlab Engine app using Visual Studio 2013. I've followed similar directions as is described at How to compile Matlab Engine in Visual Studio to set this up successfully to build to a 32-bit platform on a Windows 7 32-bit computer. Now I'm trying build to a 64-bit platform on a 64-bit (Windows 10) system. I'm pointing to all the include/libs and paths as described in the above link but when I go to build, I get the error: fatal error LNK1158: cannot run 'rc.exe'. The commonly described (discussion board) way to address this error is to copy rc.exe and rcdll.dll from C:\Program Files (x86)\Windows Kits\8.1\bin\x86 to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin But this doesn't work.
The primary question in my head as I try to debug this is that if I'm building for a 64-bit platform, should I really be copying rc.exe from the ...\8.1\bin\x86 folder? To address this, I instead copied rc.exe and rcdll.dll from the C:\Program Files (x86)\Windows Kits\8.1\bin\x64 folder to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin But that didn't work either.
What am I doing wrong?

Accepted Answer

Eric Prechtl
Eric Prechtl on 6 Feb 2016
The error was caused by where I was placing the rc.exe and rcdll.dll files. Because I'm compiling to a 64-bit platform, Visual Studio is using the 64-bit 'cross-compiler' which does not reside in the C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin but in the C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64 folder.
Thus, the solution to my problem was to copy rc.exe and rcdll.dll from the C:\Program Files (x86)\Windows Kits\8.1\bin\x86 folder to the C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64 folder.
Doing that overcame that first error.
However, upon building, a new error popped up: LNK1158: cannot run 'cvtres.exe'. In contrast to my first rc.exe error, this file actually already does reside in the C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin folder. The problem is that the cross-compiler is looking for it in its own directory. So I just copied that file from the C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin folder to the C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64 folder.
Once I did that, my project built and ran.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!