FreeType“通用"与 c++/cx 关键字冲突 [英] FreeType "generic" conflict with c++/cx keyword
问题描述
我在将 c++ 和 c++/cx 放在一起时遇到问题.我需要使用 FreeType 库,但他们对某些变量使用通用"名称.我还需要启用VC++扩展,因为WinRT应用程序会导致名称冲突(generic是c++/cx中的关键字)
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'
我只在我的项目属性中添加了 freetype 引用和其他包含目录.
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
推荐答案
使用预处理器临时重命名该关键字:
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.
这篇关于FreeType“通用"与 c++/cx 关键字冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!