how to convert cocos2d project to cocos2d-box2d project? - cocos2d-iphone

I created a project based on cocos2d,and now I want to convert to cocos2d-box2d project. What should I do? thanks

Since you're asking this question I believe it will be the easiest solution for you to create a new Cocos2D project based on the Box2D template, then add your existing project's source code and resource files to the new project. You will have to rename all implementation files from .m to .mm as well, to avoid compiler errors. This is necessary because Box2D is written in C++.

Related

Is it possible to include framework in C++ project in Xcode?

I have a C++ project generated from Cmake to Xcode. My project is just some static and dynamic libraries. I want to include some 3rd party frameworks to it.
Is it possible? Is there any chance to include? Or I should completely redesign the project to Cocoa app?
I haven't access to the framework source code.
Work with Xcode 9.2.
No, you can't use Cocoa frameworks in pure C++ project.
But you can just create an obj-c project and include all of your existing sources inside - everything will work. Just remember to use .mm extension for the source files, calling C++ code.
You can use swift as well, but that will require to create a wrapper for C++ code.

How do i use a bunch of .h and .cpp files to create a static library that can be used in another c++ Project

I am trying to learn C++ from some Stanford Course and they have a custom library which contains a bunch of header files(.h) and their associated source (.cpp) files.
I want to create new C++ projects in xcode 6.x to try out code and include those custom header files in my new projects.
I have no freaking idea how to include those files in my project so that i can peacefully #include "blahblahblah.h" and use functions from that header file without issues.
I am new to both xcode, c++(although i know some coding part) and anything else with this process.
Summary:
I have a folder Library which contains a series of .h and .cpp
files.
I have XCode 6.x.x/Eclipse installed.
I want to create a new C++ project and use #include
"OneOfThoseHeaderFiles.h" and then use a function or something from
those header files.
Also assume i have no clue how to run some command line codes that i see a lot of.
If someone can please tell me in the most simple way(preferably step-by-step) i would be so eternally grateful and sing praises to you until the day i die :)
Note: Either XCode or Eclipse is fine. I really just want to start coding.
I have spent the better part of a whole week trying out xcode, eclipse etc and trying to follow a ton of steps to get it working but i just cant get how to add the files without issues. Either the info seems to be for Xcode 4.x and every menu seems changed or the suggestions are so complicated that a novice like me cant figure it out.
First off, almost all the information for Xcode will be available on the Apple Developer's portal:
https://developer.apple.com/library/prerelease/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/start_project.html#//apple_ref/doc/uid/TP40010215-CH2-SW5
To create a simple static library on Xcode 6 you start by creating a new project, then under OS X - Framework and Library select Library, on the next window change the Framework to None (Plain C/C++ Library) and static (since that is what your are stating).
Once your project is created, add the existing headers and sources to your project, either by dragging them with the mouse or with the add files drop menu from the right click functionality, you can create a new group in Xcode if you want some order for them.
When adding the files, on the add window shown you can select to either copy them or use their current location.
If needed you might have to change the "header search path" in your target configuration under "Build Settings", if it is the first time you are using Xcode some of this will sound weird but I am sure you will find most of it on the Apple Developers portal in great detail.
If you want to test the files without having to create an external static library you could create a command line project and test them faster and easier.

Qt into ObjectiveC code

As i'am coding in objective-c, i'am wondering if i can put some Qt code in my objective-c project and compile it all together ? i did a research but the answers were kind of shady. If this is possible, do you have a hint or an answer on how to do this please ? Thank you.
It is possible, as I do this the other way round - Use Objective C in a Qt project with Qt Creator. That's easy to do by adding .m or .mm files to the project and linking to the required frameworks.
To add Qt to XCode requires creating a project file from Qt. This post seems to describe steps required to do this.

how to use xcode cocos2d project including both box2d and chipmunk?

I don't know if this sounds crazy.
I have 2 xcode projects, 1 using cocos2d-box2d and the other using cocos2d-chipmunk, and want to merge them into one single project.
I just know how to create project with choosing box2d/chipmunk, but not import one engine to an existing project with an engine.
I tried to copy files to another project and errors showed at Box2d/chipmunk classes.
How to import Box2D to a Chipmunk project (or the reserve) correctly?
Do not drop them both into your project. Create a static library target for each physics engine. That way you can make sure they build separately, and apply custom build settings for each where necessary.
Since you're already in the process of converting a project you may find it easier to migrate to Kobold2D directly. Both Box2D and Chipmunk are setup and ready to use, there's nothing speaking against using both in the same project. All you'd need to do is add the headers for both physics engines and you're ready to go.
PS: yes, it DOES sound crazy. :)
What were the errors? There shouldn't be anything that would prevent Box2D and Chipmunk from existing in the same executable. My best guess is that you have other duplicate symbols in the project or need to tweak the compile settings for something.

Default project in Visual C++ 2008

In Visual C++ 2008 ( Professional Edition )it is impossible to create default project for a .cpp file. Sometimes it is inconvenient. Is there an edition of Visual C++ 2008 which allows it?
It's available, assuming you've already written the .cpp file. Use File + New + Project From Existing Code. You'll get a point-and-click wizard with a bunch of questions that need to be answered.
I reckon you'll use this a few times, then discover it is just simpler to start a new project from scratch with the Win32 Console Application template. Just add your .cpp to the project's Source Files folder.
Why you can't do this?
You can normally create Win32 C++ project and have with this .cpp file.
You mean you don't want to create a solution each time? There's no getting around this. It can be useful to create a Sandbox solution and just fill that up with .cpp files to throw your ideas around on.