Fatal error C1189 when compiling C++ (VS2013) program in Matlab2015a(32-bit)

조회 수: 2 (최근 30일)
Ru Ma
Ru Ma 2020년 9월 28일
답변: Ru Ma 2020년 9월 29일
Hello, I am using Matlab2015a(32-bit) to compile C++ program to mex file. The compiler is Microsoft visual C++ 2013 Professional.
The code could be compiled successfully in VS2013 but error occurred when compiled it in Matlab. The error message is:
C:\Exp softwares\VS2013\ATLMFC\INCLUDE\afx.h(24): fatal error C1189: #error: Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d].
Similiar error occurred when I firstly compiled it in VS2013. After I set "Use of MFC" to "Use MFC in a shared DLL" in the property of the project, the problem solved in VS, but not in Matlab.
The code called external dll file to realize the function of data collection from a peripheral hardware. I want to use the port of the mex function to transfer data into Matlab to do futher online analysis.
Please let me know any way that could help me to fix this error. Thank you very much!

채택된 답변

Ru Ma
Ru Ma 2020년 9월 29일
Problem solved with command in Matlab: mex -D_AFXDLL -D_UNICODE MEX_EEG_Recording2.cpp
Hope this will be helpful.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by