gettext-msvc icon indicating copy to clipboard operation
gettext-msvc copied to clipboard

mbstate_t in VS2015

Open gnieboer opened this issue 9 years ago • 10 comments

Thanks for doing this!

Works in VS2015, but only after:

mbstate_t is undefined (config.h line 383) HAVE_MBSTATE_T is defined (config.h line 177)

Cheers.

gnieboer avatar Sep 07 '15 19:09 gnieboer

I am having trouble building in VS2015. I don't know what previous post means. This is my error: 1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\corecrt.h(475): error C2628: '_Mbstatet' followed by 'int' is illegal (did you forget a ';'?)

ITISAGLN avatar Jun 05 '16 00:06 ITISAGLN

@ITISAGLN,

That means in order to build in MSVC 2015, you need to change the file config.h so that the variables mentioned above are defined and undefined appropriately.

gnieboer avatar Jun 05 '16 21:06 gnieboer

Thanks. Helped me get past the same build error in VS 2015.

Just to clarify, you need to comment out #define mbstate_t int

and remove the comments around /* #undef HAVE_MBSTATE_T */

So HAVE_MBSTATE_T should be undefined since that's what #undef does, not define.

Anybody know why this change isn't merged? It was reported a year ago. Compatibility with older VS?

petermorck avatar Aug 07 '16 09:08 petermorck

Thanks for the update as I have not been able to figure this out. ...For the entire project, I did a Ctl-F for "#define mbstate_t int" and "/* #undef HAVE_MBSTATE_T */" and neither was found. Where are these? Not in config.h, right?

ITISAGLN avatar Aug 07 '16 11:08 ITISAGLN

It's in https://github.com/kahrl/gettext-msvc/blob/master/libiconv-1.14/config.h

petermorck avatar Aug 07 '16 11:08 petermorck

Ah. I was in the gettext project. Thanks alot.
Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped

ITISAGLN avatar Aug 07 '16 11:08 ITISAGLN

Thank you

stormsson avatar Nov 06 '16 21:11 stormsson

This saved a good amount of my time. Thanks. Making steps that petermorck described is still required.

Maybe we should add a note inside README?

quasilyte avatar Feb 01 '17 06:02 quasilyte

when I build finished in vs2015,I using a sample code test it ,but failed ,see follow: //code: #include <locale.h> #include <stdio.h> #include <stdlib.h> #include "libgnuintl.h" //#include "libintl.h" ` int main(void) { setlocale(LC_ALL, "");

bindtextdomain("hello", "locale");
textdomain("hello");
printf(gettext("Hello, world!\n"));
system("pause");
exit(0);

} ` when I compile it,vs2015 ,encounter just an error: Error LNK2001 unresolved external symbol _libintl_setlocale test_gettext_001

//but I using a old head file "#include "libintl.h",(come from:http://gnuwin32.sourceforge.net/packages/gettext.htm),it worked fine.

//I think the new version has better head files,how to solve it?

ghost avatar Sep 04 '17 02:09 ghost

Thanks. Helped me get past the same build error in VS 2015.

Just to clarify, you need to comment out #define mbstate_t int

and remove the comments around /* #undef HAVE_MBSTATE_T */

So HAVE_MBSTATE_T should be undefined since that's what #undef does, not define.

Anybody know why this change isn't merged? It was reported a year ago. Compatibility with older VS?

OMG THANK YOU. Still builds in VS 2019

grannypron avatar Jan 27 '21 02:01 grannypron