birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
135 stars 21 forks source link

Error: No template named 'optional' in namespace 'std' #109

Closed christophby closed 3 months ago

christophby commented 3 months ago

I cannot build the project. Error is coming from Xcode in ReactNativeFs.h.

image

No template named 'optional' in namespace 'std'

Cannot initialize return object of type 'int' with an rvalue of type 'id _Nullable'

christophby commented 3 months ago

Setting the C++ language dialect to GNU++17 fixed the issue for me. But it will be reset after a new pod install

SCR-20240517-kitm
birdofpreyru commented 3 months ago

react-native 0.69.12

As of now, for this library, I only test & support compatibility to the latest RN version, which is 0.74.

0.69 is old enough to not be maintained by RN project in general: https://reactnative.dev/versions

If you are into troubleshooting / patching it yourself, the C++ version is set in the library podfile here: https://github.com/birdofpreyru/react-native-static-server/blob/3dc459b10343fa560a0fc3856a710c761b5f9f2d/dr-pogodin-react-native-static-server.podspec#L114

which is applied each time you pod install / pod update it. Presumably, it works fine for latest versions of everything (RN, Xcode, etc.), and I am not sure why it does not work for older RN. Or, perhaps, it does not work as intended, but with latest versions of everything something else enforces the correct version.

birdofpreyru commented 3 months ago

or, if you aren't using the latest version of this lib, I think there was error in older version, where that setting wasn't always applied, then perhaps you need to set it as in the latest version.

christophby commented 3 months ago

I'm using the latest versions

But I will probably patch it, thank you!