Cocos2D 3.1 Xcode 4.5.2 Default project not compile - cocos2d-iphone

I have Xcode 4.5.2 and I installed Cocos2D 3.1.0. When I create a project, the default code doesn't compile. I have the error ARC Semantic Issue : No visible #interface for 'CCNode' declares the selector 'wasRunning'. There is the function -(void)wasRunning:(BOOL)wasRunning in CCNode.m but it's not declared in CCNode.h. So I put it in CCNode.h or move the function in CCNode.m at the beginning of CCNode.m, and the error disappears.
Then I have another error in CCScheduler.m : 'CCScheduledTarget' does not have a member named '_paused'. As I don't want to modify a DEFAULT project like that, I gave up to ask why I have those errors in a default project and how to correct them correctly?

Related

Xcode 12 throwing new C++ errors when compiling mapbox-gl-native

I have always been able to compile a custom copy of mapbox-gl-native, but with the installation of Xcode 12 this has broken. I am getting the following errors:
No matching function for call to 'get'
How can I fix this C++ error that is showing? I am assuming this is happening because of updated Xcode tools.

New C++ Project in Xcode 10.2 is not building

Have a macOS Mojave 10.14.6 with Xcode 10.2 (10E125)
I simply created new c++ project in this way:
Xcode -> New Project -> Command Line Tool -> [C++ Language] ->
Next/Done
And it's not building at all. I even not touched code.
Here is errors
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:74:64: Use of undeclared identifier 'strchr'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:81:75: Use of undeclared identifier 'strpbrk'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:88:65: Use of undeclared identifier 'strrchr'; did you mean 'strchr'?
etc...
NOTE 1: I tried to create same project but with C Language. And C Project working well until I'm adding #include <vector>. With vector I have same errors as in case with new C++ project.
NOTE 2: I don’t think, that something is not been installed on my system. Since the same code works well with Objective-C project. (and I do not want to use h+mm I want to use hpp+cpp, if that is the problem)
I have your same setup, and it doesn't occur to me. Was you XCode installation like this from the start, or did it happen after you've done a couple of projects?
If it happened later on, my reasoning is this; once I used the fix button inside of XCode, but, instead of fixing my own code, it went and modified a system header. Perhaps this is what happened to you as well?
If that's the case, you need to reinstall the whole party.

Unknown Type name 'class'; did you mean Class'? ERROR on CCApplicationProtocol.h, CCApplication.h and Expected ';' after top level declarator ERROR

I am using cocos2d-x on an iOS game. But I am getting some errors that are preventing the app to compile properly. Here's a screenshot to emphasize the issues:
Any ideas on how to fix those errors? I tried the Xcode suggested methods, like replacing class with Class, but this produces even more errors. Whatever Xcode suggested did not work.
Issues have been solved. I did not touch anything in code. I remember that I recently added few files into the cocos2dx project that was NATIVE iOS code:
ProjectFile.h
ProjectFile.m
ProjectFile.xib
I renamed that ProjectFile.m to ProjectFile.mm and it compiled without errors! So if you have any Objective C classes added into the project and see that error, try changing .m to .mm as Bo Perssoon suggested. THANKS!

Debugging SFML Project in Xcode - Install to Blame?

I followed the instructions to set up SFML here. When I check my /Library/Frameworks folder, all the SFML stuff seems to be there. However, when I check out a project my group is working on using SFML, and when I build, I get a ton of errors. These errors do not exist for my other group members. I think (some of) my errors are caused by SFML not recognizing sf::Input as a type.
Here is my code for one of the header classes in my project:
#pragma once
#include "Mover.h"
class InputMover : public Mover
{
public:
InputMover(const sf::Input* pInput);
//error here - expected unqualified-id before * token
protected:
const sf::Input* m_pInput;
//error here - ISO C++ forbids declaration of Input with no type
};
The parts without errors have been taken out. What do you think the problem is?
EDIT, SOLVED:
The problem was that I installed SFML with makefiles before I just did a copy-install. Some files were conflicting. I tracked down the installed files and deleted them. This seemed to fix the problem.
To use the SFML classes you need to include their definitions.
Add #include <SFML/Window/Input.hpp> to the top of your file.
Also note that to use SFML you must also link to the CoreFoundation, Cocoa and OpenGL frameworks, as well as to libfreetype.

want to buiild fruit ninja type slice effect

I am trying to use a code that draws Fruit Ninja style swiping effect using the code at https://github.com/hiepnd/CCBlade
When Compiling I get error at the line #include < list >
(CCBlade.h:14:0 CCBlade.h:14:15: error: list: No such file or directory)
It works fine when integrated with a .m file, but the error is when trying to use it with .mm
Any solutions for this ?
Did you correctly adjust build setup for compiler? In order to compile c++ source code, you need to change compiler properly in build option.
Do the following if you are using Xcode 4.2:
1. Click on the CCBlade.m file.
2. Look to the right panel (first panel is all your project files, middle panel is your codes and the last panel is the properties).
3. On the Identity and Type, select "Objective C++ Type" for the File Type.
4. Vice-versa for TouchTrailLayer.m.
Hope that helps!
I was getting errors 'inline function declared but never defined' when trying to build the project. This is due to inline C functions in the CCBlade class.
The solution to fix this is simple, rename all classes that use CCBlade with .mm file extension(Objective-C++ files). This fixes the errors.