编译freetyp问题。#include expected a filename, found 'identifier'

自己建立vc工程,编译freetype时,出错。


#include expected a filename, found 'identifier'


解决办法:

禁掉VC的precompiled headers。

工程Settings->C/C++->Category(Precompiled Headers)

选择Not Using precompiled headers


What are precompiled headers?

Often C++ source files include headers from external libraries. In Windows you include windows.h. These header files are often very large and takes some time to process. Each time you compile a C++ file the compiler has to read and process thousands of lines from these header files. But external libraries don't change and you can save a lot of time if you only process these files once and save the result.

A precompiled header is simply a bunch of header files that has been processed to an intermediate form that later can be used by the compiler again and again.

Precompiled headers in Visual C++

In Visual C++ it is customary to put all your non-changing header files in stdafx.h. You then instruct the compiler to create the precompiled header stdafx.pch while compiling stdafx.cpp. If you want to use the precompiled header in another .cpp file you have to include stdafx.h as the first include file and the instruct the compiler to use stdafx.pch for your precompiled header.

If you get an error about not including stdafx.h you simply have to instruct the compiler to not use a precompiled header for that particular source file. (Or you can include stdafx.h.)

Precompiled header settings for individual source files

Visual C++ allows you to control the compiler settings for the entire project and for individual files. To access individual properties you select the source file in the solution explorer, right click it and select Properties from the context menu. The options for precompiled headers are found at Configuration Properties => C/C++ => Precompiled Headers. If you modify these settings you will often want to do that for all configurations (e.g. Debug and Release).

When you are using precompiled headers you will have a setting for the entire project that instructs the compiler to use stdafx.pch for the precompiled header. The stdafx.cpp will have an individual settings that instructs the compiler to generate stdafx.pch, and if you have some source files that doesn't include stdafx.h you can set individual settings on these to not use precompiled headers.


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值