FreeType "generic" conflict with c++/cx keyword
Asked Answered
M

1

11

I have a problem with putting c++ and c++/cx together. I need to use FreeType library, but they are using "generic" name for some variable. I also need to enable VC++ extensions because WinRT app, which causes name conflict (generic is keyword in c++/cx)

1>freetype2\include\freetype\freetype.h(1391): error C2059: syntax error : 'generic'

I only added freetype reference and aditional include directories to my project properties.

Is there some way to solve this case? Thank you for your help :) Tomas

Mercury answered 29/10, 2012 at 13:6 Comment(2)
How are you solve a /ZW option conflict for WinRT app ? Just rename *.c file to *.cpp ?Perhaps
Hi - I found this question while hitting the exact same issue. Are you also trying to compile Freetype with /clr:pure? If so, did you succeed?Purposeless
F
17

Use preprocessor to rename this keyword temporarily:

#define generic GenericFromFreeTypeLibrary
#include .... files from FreeTypeLibrary
#undef generic

This solution is not very nice but should work.

F answered 29/10, 2012 at 13:9 Comment(3)
Could you give an explicit example of what should this look like? What do you mean by GenericFromFreeTypeLibrary?Also
GenericFromFreeTypeLibrary is just arbitrary created name - just to cause FreeTypeLibrary will use this name instead of generic - which is keyword in WinRT. You can use ABRACADABRA or whatever you want - assuming it will not cause any new conflicts...F
Ok I thought I had to replace that thing with something else.Also

© 2022 - 2024 — McMap. All rights reserved.