cppcomponents icon indicating copy to clipboard operation
cppcomponents copied to clipboard

msvc2013 errors

Open r-lyeh-archived opened this issue 10 years ago • 1 comments

D:\prj\cppcomponents\examples\example1>cl example1.cpp -I ..\.. /EHsc 
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.30501 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

example1.cpp
d:\prj\cppcomponents\examples\example1\library.h(17) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cdecl *)(void)'
        Incompatible calling conventions for UDT return value
D:\prj\cppcomponents\examples\plugin>cl plugin1.cpp -I ..\.. /EHsc
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.30501 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

plugin1.cpp
d:\prj\cppcomponents\examples\plugin\plugin.hpp(23) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cdecl *)(void)'
        Incompatible calling conventions for UDT return value
d:\prj\cppcomponents\examples\plugin\plugin.hpp(31) : error C2039: 'cr_string' : is not a member of 'cppcomponents'
d:\prj\cppcomponents\examples\plugin\plugin.hpp(31) : error C2061: syntax error : identifier 'cr_string'
d:\prj\cppcomponents\examples\plugin\plugin.hpp(32) : error C2039: 'cr_wstring' : is not a member of 'cppcomponents'
d:\prj\cppcomponents\examples\plugin\plugin.hpp(32) : error C2061: syntax error : identifier 'cr_wstring'
d:\prj\cppcomponents\examples\plugin\plugin.hpp(40) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cdecl *)(void)'
        Incompatible calling conventions for UDT return value
plugin1.cpp(5) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cdecl *)(void)'
        Incompatible calling conventions for UDT return value
plugin1.cpp(24) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cdecl *)(void)'
        Incompatible calling conventions for UDT return value

etc...

ideas?

r-lyeh-archived avatar May 08 '15 20:05 r-lyeh-archived

I updated cppcomponents after the CppNow 2014 presentation, but did not update the examples. Thanks for bringing it to my attention.

To update this, in the inline id functions for example inline std::string Command1Id(){return "Command1";}

change the return type to const char*

For cr_string, change to string_ref, and cr_wstring to wstring_ref

Let me know how this works.

  • John

On Fri, May 8, 2015 at 4:33 PM r-lyeh [email protected] wrote:

D:\prj\cppcomponents\examples\example1>cl example1.cpp -I .... /EHsc Microsoft (R) C/C++ Optimizing Compiler Version 18.00.30501 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

example1.cpp d:\prj\cppcomponents\examples\example1\library.h(17) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cd ecl *)(void)' Incompatible calling conventions for UDT return value

D:\prj\cppcomponents\examples\plugin>cl plugin1.cpp -I .... Microsoft (R) C/C++ Optimizing Compiler Version 18.00.30501 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

plugin1.cpp D:\Archivos de programa (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337) : warning C4530: C++ exception handler used, but unwind semantics are not ena bled. Specify /EHsc d:\prj\cppcomponents\examples\plugin\plugin.hpp(23) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cde cl *)(void)' Incompatible calling conventions for UDT return value d:\prj\cppcomponents\examples\plugin\plugin.hpp(31) : error C2039: 'cr_string' : is not a member of 'cppcomponents' d:\prj\cppcomponents\examples\plugin\plugin.hpp(31) : error C2061: syntax error : identifier 'cr_string' d:\prj\cppcomponents\examples\plugin\plugin.hpp(32) : error C2039: 'cr_wstring' : is not a member of 'cppcomponents' d:\prj\cppcomponents\examples\plugin\plugin.hpp(32) : error C2061: syntax error : identifier 'cr_wstring' d:\prj\cppcomponents\examples\plugin\plugin.hpp(40) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cde cl *)(void)' Incompatible calling conventions for UDT return value plugin1.cpp(5) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cdecl *)(void)' Incompatible calling conventions for UDT return value plugin1.cpp(24) : error C2440: 'specialization' : cannot convert from 'std::string (__cdecl *)(void)' to 'const char *(__cdecl *)(void)' Incompatible calling conventions for UDT return value

etc...

ideas?

— Reply to this email directly or view it on GitHub https://github.com/jbandela/cppcomponents/issues/3.

jbandela avatar May 08 '15 21:05 jbandela