Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FreeType "generic" conflict with c++/cx keyword

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

like image 899
Lipov3cz3k Avatar asked Oct 29 '12 13:10

Lipov3cz3k


1 Answers

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.

like image 171
PiotrNycz Avatar answered Nov 02 '22 17:11

PiotrNycz