1

I am writing a BCI game application in VC++ and require to implement Common Spatial Pattern Filtering (CSP) for feature extraction. Due to the hefty coding involved, I prefer to use an existing CSP Matlab function that I have. I followed the steps as given in here. However, I am getting the following Link error message:

1>------ Build started: Project: Test4, Configuration: Debug Win32 ------
1>test.obj : error LNK2019: unresolved external symbol _mxGetScalar referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _mxDestroyArray referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _mxCreateDoubleScalar referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _engEvalString referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _engOpen referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _engClose referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _engGetVariable referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _engPutVariable referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol _engOutputBuffer referenced in function _main
1>D:\Test4\Debug\Test4.exe : fatal error LNK1120: 9 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Could anyone please help me fix the problem? Any comments would be appreciated. Thanks in advance.

Niall
  • 30,036
  • 10
  • 99
  • 142
Adee_lib
  • 39
  • 1
  • 8
  • Did you instal the MCR (_Matlab Compiler Runtime_) on the same machine you run VC++ ? – Hoki Oct 02 '14 at 08:05
  • I have both, MS VC++ and Matlab 2013a on the same PC. – Adee_lib Oct 02 '14 at 08:07
  • ok, but i think you also need the MCR installed anyway. – Hoki Oct 02 '14 at 08:11
  • What's the build target of your project? x64 or x86? Make sure you set the proper Matlab library path of different platforms. – herohuyongtao Oct 02 '14 at 08:15
  • @Hoki, I installed MCR too, but no luck. – Adee_lib Oct 02 '14 at 08:33
  • @herohuyongtao : I know I have VC++ 2013 installed on Win7 (64-bit). I have set the Matlab library path as mentioned on your blog. Could you kindly tell me what and where exactly should I check to help you figure out the problem? Thnx – Adee_lib Oct 02 '14 at 08:39
  • @Adee_lib Try to add `MATLAB-path\R2013a\extern\lib\win64\microsoft` to the library directories even you're building a Win32 project. Also add `libmx.lib libeng.lib` to the `Input` libraries. – herohuyongtao Oct 02 '14 at 08:42
  • @herohuyongtao I did as you mentioned, but no luck. I have emailed you screenshots of my settings. Plz check and hope it helps. – Adee_lib Oct 02 '14 at 09:05

1 Answers1

2

As I said in the referred post, you have to keep the platforms consistent:

The platforms of MATLAB and VC++ compile platform must be the same, i.e. Win32/x86 VC++ compile platform can only use x86 MATLAB and x64 VC++ compile platform can only use x64 MATLAB.

You're using MATLAB x64, thus you have to build your VC project in x64 too.

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174