Comments (10)
I also run into this issue. To analyse it I run Product -> Generate Output -> Preprocessed File to get a preprocessor output (gcc/clang -E option). Quick glance revealed that cocos2dx uthash.h includes <inttypes.h> in the cocos2d namespace which ruins stdint.h inclusion. _UINT8_T macro is set, but uint8_t type is defined in cocos2d namespace and not in global.
I dirtyfixed it by moving #include <inttypes.h> line in uthash.h to the beginning of the file.
from cocos2d-x.
Works for me too, but I guess it needs to be checked on other platforms than IOS
from cocos2d-x.
We can use macros to make the static_casts only happen for C++11, if people are worried about other platforms. Can we get this done?
from cocos2d-x.
Could you not just set all those -1s to UINT32_MAX? That might be faster and we wouldn't need to care about the platform.
from cocos2d-x.
This works for me with XCode 4.4, cocos2d-x 2.0:
- Select your Target > Build Settings > All
- Find
C++ Language Dialect
, selectC++11 [-std=c++11]
- Find
C++ Standard Library
, selectlibc++ (LLVM C++ standard library with C++11 support)
from cocos2d-x.
Just a warning, if you compile with -std=c++11, then your app will require iOS version 5 or above. I use -std=gnu++11. I had to fix some errors due to bad casts.
from cocos2d-x.
This issue can be closed as "not a cocos2d-x issue" or "as designed".
XCode 4.5 does not fully support c++11:
@minggo @dumganhar @walzer :-)
from cocos2d-x.
@donaldalanmorrison Nothing in cocos2dx uses anything new in the c++11 standard. So it should still compile against it.
For myself the errors occurring where:
'Unknown type name 'class'; did you mean 'Class'?'
This issue is to do with Xcode->Build Settings->Compile Sources As="According to File Type"
When compiling cocos2dx there is a mix of objective-c & c++. Xcode does struggle to differentiate between the two types. The solution is to wrap each header in a ifdef for that platform. If compiling CCSprite.h wrap the header in:
#ifdef __cplusplus
CCSPRITE HEADER
#endif /* __cplusplus */
the same too for any objective-c files (OBJC)
After the above, Xcode no longer confuses objc with c++ & the cocos2dx source compiles against c++11.
An easy win that won't cause any complications on other platforms I believe.
As for why to bother doing it: I'm new to C++ & using the latest standard does help make things easier.
Cheers,
Ryan
from cocos2d-x.
@Klaim Please, could you open a bug in redmine in future? We are in process of migrating all the issues to redmine and github issue won't be available after August.
from cocos2d-x.
@godyZ Noted!
from cocos2d-x.
Related Issues (20)
- fix the bug that ect1 texture lost on android
- undefined reference to libchipmunk.a HOT 3
- AttributeError: 'URLError' object has no attribute 'code' HOT 1
- FlipY3D issue if setDesignResolution and RenderTexture is used HOT 1
- Want Cocos2d-x v4 Mac to use openGL rendering,what can i do HOT 2
- Is project dead? HOT 5
- Where is CCGLProgram.cpp ? HOT 1
- A iOS crash occurs when we replace the network module with cocos-engine/native/cocos/network.
- [Feature Request] Build external libs from source HOT 1
- Compiling with Ninja Generator and CLION
- Null Image Data In RenderTexture::newImage Callback
- 错误:找不到 <js> 模板。 HOT 1
- cocos run -p mac出错,只能web,编译也是,平台只能web,其他都会报错
- 4.0是不是不支持js了??? HOT 1
- libMiniCL.a link error when building for iOS Simulator
- Failed to build from source on Ubuntu 22.04 HOT 3
- cocos2d游戏项目在IOS上真机调试
- cocos2dx-lua 还有计划支持国产系统吗? HOT 1
- Packaging iOS applications in the GitHub Actions workflow HOT 1
- An error when Build apk at Apple Silicon
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocos2d-x.