0

I am trying to read mat-files in C++ in a Qt project. At morning I had next problem: Read Mat Files in C++ in a Qt project, and it is solved already. But now I am having problems with the next issue:

matrix.h:267: error: C2146: syntasis error :';'is missing before 'mxChar'
c4430 missing type specifier - int assumed. note c++ does not support default-int

In my project.pro I am telling it:

QMAKE_CXXFLAGS += -EHsc -std=c++11 -Zc:wchar_t
QMAKE_LFLAGS +=  -std=c++11

In the tmwtypes.h where types are defined:

/** UTF-16 character type */

#if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT)
typedef UINT16_T CHAR16_T;
#define U16_STRING_LITERAL_PREFIX u
#elif defined(_MSC_VER)
typedef wchar_t CHAR16_T;
#define U16_STRING_LITERAL_PREFIX L
#else
typedef UINT16_T CHAR16_T;
#endif

#endif  /* __TMWTYPES__ */

#endif /* tmwtypes_h */

In the matrix.h:

/*
 * Logical type
 */
typedef bool mxLogical;

/*
 * Typedef required for Unicode support in MATLAB
 */
typedef CHAR16_T mxChar;

Thanks in advance,and sorry if it is a amateur question.

Community
  • 1
  • 1
Arritmic
  • 474
  • 2
  • 12
  • 3 questions: (1) which compiler are you using? (2) does `matrix.h` actually include `tmwtypes.h`? (3) does the type which you map to `CHAR16_T` actually exist, i.e. is it defined by the compiler or another header you are including? – mindriot Feb 08 '16 at 19:47
  • 2
    I'd run the preprocessor on this to see which branch is actually taken and thus which type is being selected: http://stackoverflow.com/questions/277258/how-do-i-see-a-c-c-source-file-after-preprocessing-in-visual-studio (assume VS due to the "c4430" error naming style) – iksemyonov Feb 08 '16 at 19:53
  • Thanks @mindriot (1) VS 2012. (2) Yes (3) I think so. In theory is defined in tmwtypes... – Arritmic Feb 09 '16 at 10:26
  • @iksemyonov thanks for the link. I am going to review it. – Arritmic Feb 09 '16 at 10:27

0 Answers0