Tuesday, 15 June 2010

c++ - Compile a C library with Visual Studio 2010 -



c++ - Compile a C library with Visual Studio 2010 -

i got here c library written else, nice way compile on mac , generate ruby wrapper.

i on windows, , need generate wrapper .net. know absolutely nil c or c++.

i have created .i file %include .h file, , used swig generate c# files , xxx_wrapper.c file. i have created empty c++ project visual studio 2010, , included .h , .c files of project (except ones generate ruby wrapper)

now when seek compile, few compilation errors each time there inline function:

file.c(54): error c2054: '(' expected after 'inline' file.c(54): error c2085: 'swap_img' : not in formal parameters list file.c(54): error c2143: syntax error: missing ';' before '{'

i have read here might because vs tries compile c files c++. how do ? can't alter in code (and wouldn't try), need "fix" project.

thanks !

in version of c language that's supported visual studio 2010, there no word inline. c++ has inline. don't think inline became part of c until latest version of c standard (c11), nobody supports yet.

instead, should utilize word __inline, means same thing. underscores imply "extension," that's not part of standard c.

alternatively, set #define inline __inline @ start of each file, or in .h header file #included @ beginning. automatically translate word inline __inline each time appears.

(it's person wrote code using different compiler, 1 chose add together inline without underscores. it's still "extension" because it's not part of standard c.)

c++ c visual-studio-2010

No comments:

Post a Comment