error 2059 in loadlibrary

조회 수: 11 (최근 30일)
Jack C
Jack C 2017년 3월 21일
댓글: Rena Berman 2017년 3월 23일
I'm attempting to run a code through matlab on Windows 10 which was previously run on windows XP. Currently running MATLAB 2015a (64-bit) with Windows 7.1 SDK as the compiler. I get the following error:
Error using loadlibrary (line 395)
Building quadrupledll_thunk_pcwin64 failed.
quadrupledll.h(14) : error C2059: syntax error : 'string'
quadrupledll.h(16) : error C2059: syntax error : 'string'
quadrupledll.h(18) : error C2059: syntax error : 'string'
I assume referring to the lines beginning 'extern'.
The header file is as follows:
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the QUADRUPLEDLL_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// QUADRUPLEDLL_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef QUADRUPLEDLL_EXPORTS
#define QUADRUPLEDLL_API __declspec(dllexport)
#else
#define QUADRUPLEDLL_API __declspec(dllimport)
#endif
extern "C" QUADRUPLEDLL_API int __stdcall move_left_assembly(int,int);
extern "C" QUADRUPLEDLL_API int __stdcall move_right_assembly(int,int);
extern "C" QUADRUPLEDLL_API int __stdcall cleanup();
  댓글 수: 5
Walter Roberson
Walter Roberson 2017년 3월 23일
Jack C:
We are volunteers. The "price" we charge for answering questions is that your questions and remarks and the answers to them stay public, in order for everyone to be able to learn from them. When you delete your content, we start to feel as if you are treating us as if we are free private consultants, and we are not happy about that.
Rena Berman
Rena Berman 2017년 3월 23일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

채택된 답변

Philip Borghesani
Philip Borghesani 2017년 3월 22일
Loadlibrary compiles all thunk files as c not c++. The header file used must be c compatible, wrap all extern "C" statements with #ifdef __cplusplus as is normally recommended for c compatible headers.
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 3월 22일
#ifdef...
extern "C" {
#endif
Put the declaration here
#ifdef...
}
#endif
As an outline

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by