hkmoffat / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

Redefinition of basic type: char16_t when compiling 64bit MATLAB Interface #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When compiling on Win7, 64 bit with VS 10.0 and MATLAB R2011b 64bit, I get the 
following error:

cl ...... ctfunctions.cpp
C:\Program Files\MATLAB\R2011b\extern\include\tmwtypes.h(821) : error C2371: 
'char16_t' : redefinition; different basic types
        C:\Program Files (x86)\Microsoft Visual Studio 10.\VC\INCLUDE\yvals.h(576) : see declaration of 'char16_t'
scons: *** [build\src\matlab\ctfunctions.obj] Error 2

However I see in ctmatutils.h (lines 9-14) I see some sort of workaround, which 
I think is causing the problem. I commented out line 13:

#define CHAR16_T char16_t

And it compiles and runs OK... bit odd?

Original issue reported on code.google.com by maoriele...@gmail.com on 13 May 2012 at 3:48

GoogleCodeExporter commented 9 years ago
I think the right solution to this will be to add a SCons 'Configure' test to 
see whether this workaround is necessary for the active compiler and Matlab 
version. I don't currently have a Windows environment with multiple Matlab 
versions, so I can't test such a solution.

Original comment by yarmond on 24 May 2012 at 4:43

GoogleCodeExporter commented 9 years ago

Original comment by yarmond on 14 Nov 2012 at 4:26

GoogleCodeExporter commented 9 years ago
Same issue at r1963, on Win7 32-bit with VS 10.0 and MATLAB R2011b 32-bit. 
Again, commenting out #define CHAR16_T char16_t in ctmatutils.h helps. 

Original comment by mok...@gmail.com on 8 Dec 2012 at 10:27

GoogleCodeExporter commented 9 years ago
MATLAB R2010a redefines the char16_t type in a method that is incompatible with 
VS2010 (and higher?). A workaround was added to ctmatutils.h to allow 
compilation for R2010a and VS2010 (it is unclear from the code history when 
this workaround was introduced). Unfortunately, this workaround breaks for 
MATLAB later than R2011b (as shown in this issue) and VS2012 and VS2013.

This post from the Mathworks forum: 
http://www.mathworks.com/matlabcentral/newsreader/view_original/767057
suggests an alternate workaround. According to 
https://groups.google.com/d/topic/cantera-users/1TMVaPqyMTw/discussion
the new workaround fixes the error on MATLAB R2010a while not introducing the 
new error on newer versions of MATLAB. This fix should now work with (at least) 
VS2012, VS2013, and MATLAB 2010a and 2014a.

Original comment by bryan.w....@gmail.com on 26 Aug 2014 at 12:14

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r3116.

Original comment by bryan.w....@gmail.com on 26 Aug 2014 at 12:15