'How to use nesting defines from objc/c in swift?
I have C header with some defines from a library vendor. Defines look likes:
#define TEST_DEFINE_1 0x12340000
#define TEST_DEFINE_2 TEST_DEFINE_1
#define TEST_USE_DEFINE_1 (TEST_DEFINE_1| 0x0001)
#define TEST_USE_DEFINE_2 (TEST_DEFINE_2| 0x0001)
I want to use these defines in my swift code, so i added Bridging Header:
#ifndef Bridging_Header_h
#define Bridging_Header_h
#include "defines.h"
#endif /* Bridging_Header_h */
And use them:
print(TEST_DEFINE_1)
print(TEST_DEFINE_2)
print(TEST_USE_DEFINE_1)
// This line causes error "Cannot find 'TEST_USE_DEFINE_2' in scope"
print(TEST_USE_DEFINE_2)
So i can't use nested defines with arithmetic.
Is there problem in swift/xcode? Or am i doing it wrong?
There is repo with minimal example: https://github.com/aatriff/define_test
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
