Compiler errors 错误:在我的IOS游戏上适当加载时,文件结尾没有换行符[-Werror,-Wnewline eof]#endif

Compiler errors 错误:在我的IOS游戏上适当加载时,文件结尾没有换行符[-Werror,-Wnewline eof]#endif,compiler-errors,clang,warnings,xcode4.6,Compiler Errors,Clang,Warnings,Xcode4.6,我的cocos2d iOS游戏代码在Xcode 4.6.2中编译和运行时没有错误,但适当的加载停止时出现“文件末尾没有换行符”错误。例如: 在/Users/james/.apportable/SDK/System/dispatch/dispatch.h:28:sysroot/common/usr/include/stdint.h:42:7包含的文件中:错误:文件末尾没有换行符[-Werror,-Wnewline eof]#endif 您可以通过转到“.approj”文件夹中的“configura

我的cocos2d iOS游戏代码在Xcode 4.6.2中编译和运行时没有错误,但适当的加载停止时出现“文件末尾没有换行符”错误。例如:

在/Users/james/.apportable/SDK/System/dispatch/dispatch.h:28:sysroot/common/usr/include/stdint.h:42:7包含的文件中:错误:文件末尾没有换行符[-Werror,-Wnewline eof]#endif


您可以通过转到“.approj”文件夹中的“configuration.json”来处理Apportable使用的参数,找到该部分

// Edit this section to add and replace files and parameters to the generated settings for this project.
// If the generated settings for a particular file are incorrect, simply add it here with the settings
// you need and the final build parameters will only included the version specified here.
"add_params": {
并在“flags”数组中添加所需的标志,如下所示

// A list of global compile flags for the project.
// Flags can be either a string, e.g. "-Werror-shadow",
// or a dictionary specifying the flag and the environment
// that it should be used in, e.g.,
// {"flag": "-fstack-protector", "env": {"TARGET_OS": "android"}}
"flags": [ "-Wno-four-char-constants", "-Wno-conversion", "-Wno-gnu", "-Wno-pedantic", "-Wno-selector", "-Wno-sign-conversion" ],

对于这个特殊的错误,“-Wno newline eof”将是合适的。

这真的很奇怪,但是您需要在文件末尾有一个尾随行!因此,只需打开您正在编译的文件(
/Users/james/.apportable/SDK/System/dispatch/dispatch.h
sysroot/common/usr/include/stdint.h
),如果还没有空行,只需添加空行即可。

您无法更改该头文件,因此您别无选择,只能删除
-Wnewline eof
编译器参数。我不知道为什么它会被使用。