- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
TARGET_IPHONE_SIMULATOR 宏在我添加到项目的 C++ 源代码中不起作用。不过应该注意,如果我只是用 1 或 0 更改宏,代码就会运行。
这是设置。我一直在转换文件: https://code.google.com/p/ld48jovoc/source/browse/util/tweakval/?r=13使用我在 XCode 中制作的 iOS 应用程序。
除了标题外,一切都几乎相同。
#ifndef TWEAKVAL_H
#define TWEAKVAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
// Do only in debug builds on simulator, this does NOT work on iOS device
#if TARGET_IPHONE_SIMULATOR // replace with 1 or zero to make it work
# define TV_USE_TWEAKVAL 1
#else
# define TV_USE_TWEAKVAL 0
#endif
//
// See the thread referenced above for idea of how to implement
// this without the __COUNTER__ macro.
// If we are in a build modethat wants tweakval, and the compiler
// supports it, use it
#if TV_USE_TWEAKVAL
# define _TV(Val) _TweakValue( __FILE__, __COUNTER__, Val )
//float _TweakValue( const char *file, size_t counter, float origVal );
int _TweakValue( const char *file, size_t counter, int origVal );
void ReloadChangedTweakableValues();
#else
// don't use it
# define _TV(Val) Val
# define ReloadChangedTweakableValues()
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif
cpp 文件几乎相同,只是整个文件都包含在#if TV_USE_TWEAKVAL 中。
现在我可以通过代码或在build设置中手动设置这个宏,但我更愿意通过检测预处理器命令让这个东西自动启用/禁用。我的猜测是宏在链接 tweakval 源代码时未被检测到,我不知道我需要更改哪些build设置来解决此问题。
谢谢。
最佳答案
TARGET_IPHONE_SIMULATOR
来自 TargetConditionals.h
。您需要#include
该文件。大概您的其他代码通过一些其他路径间接获取它,例如 Cocoa/Cocoa.h
。
关于c++ - 在 C++ 中使用 TARGET_IPHONE_SIMULATOR 时出现链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18495213/
我的环境:ObjectiveC 在 OS X El Captain (10.11.1) 中使用 Xcode 6.4。在 Xcode 中,目标设置为 iOS 8。 TARGET_IPHONE_SIMUL
我正在使用适用于 iOS(增强现实)的 Vuforia 库。库框架仅针对 armv7 和 v7s arch 编译 - 因此它不会在模拟器 (i386 arch) 中运行。为了在模拟器中测试我的应用程序
TARGET_IPHONE_SIMULATOR 宏在我添加到项目的 C++ 源代码中不起作用。不过应该注意,如果我只是用 1 或 0 更改宏,代码就会运行。 这是设置。我一直在转换文件: https:
我是一名优秀的程序员,十分优秀!