Include msgpack in cocos2d-x 3 - cocos2d-x-3.0

I want to use msgpack with cocos2d-x 3.
I add include_directories(msgpack/include) in cocos2d/cocos/CMakeLists.txt. but not found msgpack.hpp.
How I can include and compile msgpack with cocos2d?

Have a look at https://github.com/msgpack/msgpack-c. Just put content of msgpack-c/include in yourproject/Classes and add line #include <msgpack.hpp> to you cpp file.
Don't add stuff in cocos2d/cocos/CMakeLists.txt because it is build file for cocos library. Add msgpack in yourproject/CMakeLists.txt
cmake in cocos2dx actually only for linux.

Related

mailcore2 how to implement it in swift

I tired to follow these instructions here https://github.com/MailCore/mailcore2/blob/master/build-mac/README.md but I didnt understand or dont know how to implement it in my swift app.
I know how to set up the session etc but how to install mailcore2 library onto my app is what im having problems with.
One of the things that worked for me without pods nor carthage was to download the mailcore2 library and copy the whole mailcore2 folder to the project folder. then follow this steps:
Go to Build Phases from your build target, and under 'Link Binary With Libraries',
Add libMailCore-ios.a
Add CFNetwork.framework
Add Security.framework
Set 'Other Linker Flags' under Build Settings:
-lctemplate-ios -letpan-ios -lxml2 -lsasl2 -liconv -ltidy -lz -lc++ -lresolv -stdlib=libc++ -ObjC
Make sure to use LLVM C++ standard library. Open Build Settings, scroll down to 'C++ Standard Library', and select libc++.
In Build Phases, add a Target Dependency of static mailcore2 ios.
For Swift - If you are using Mailcore in a Swift project you also need to complete the following steps:
* Create a new header file in your project and name it Project-Name-Bridging-Header.h.
* Remove any template code from the file and add #import
* In your target settings search for Objective-c Bridging Header and add a link to your bridging header. (Project-Name-Bridging-Header.h)
* You do not need to import Mailcore in any of your classes as the bridging header takes care of this automatically.

Android JNI c++ files compiling

I'm using JNI in Android development. I want to know where do the compiler find the referenced .h files?
Here in jni/jni_part.cpp, it includs lots of .h files. Opencv related files are defined by the SDK, but the "cartoon.h" is sure to be a project-specified header. But I cannot find it in the project folder. Then do the eclipse compile the JNI c++ code at every run? If so , in which directories does the eclipse find these headers?
Maybe it's basic for JNI but I'm not familiar with it. So plz help me out with one or two sentences. Or you could just paste a simple tutorial for JNI in Android, eclipse.
#include <jni.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include "cartoon.h"
#include "ImageUtils.h" // Handy functions for debugging OpenCV images, by Shervin Emami.
using namespace std;
using namespace cv;
extern "C" {
.....
This is my eclipse project folder structure
/project
/jni
jni_part.cpp
/src
something.java
You'll need to start using android-ndk to compile the .c, .cpp files to a .so library object, which you can then use in your android project.
Please refer to the Android NDK to get started.
http://developer.android.com/tools/sdk/ndk/index.html#GetStarted
you can find examples in the NDK download.
If Eclipse "knows" where cartoon.h file is on disk, it will help you find it - put the cursor on that #include line and press F3.
Regarding your other question: Eclipse compiles only if the relevant files (sources, headers, or mk) change.

Adding QtCore Library in blackberry 10 sdk

Hi guys I am creating a simple game using cocos2d-x and blackberry. I need some place to store my game settings, something similar to shared preferences in ios and android. I found some code using qsettings, but the problem is I am not able to add the QtCore library.
I add the library using RightClick->configure->add Library and Standard BlackBerry Platform Library. The library gets added successfully.
#include "dataProcessor.h"
#include <QtCore>
void dataProcessor::setup(){
QDir dir;
dir.mkpath("data/files/text");
dir.cd("data/files/text");
}
but when I compile the above code, I get the error C:/Users/I076636/Documents/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h:45:28: fatal error: QtCore/qglobal.h: No such file or directory
But I noticed 2 things,
1.qglobal.h file is there inside the QtCore directory I have included.
2.inside qatomic.h if I change
#ifndef QATOMIC_H
#define QATOMIC_H
#include <QtCore/qglobal.h>
#include <QtCore/qbasicatomic.h>
into
#ifndef QATOMIC_H
#define QATOMIC_H
#include <qglobal.h>
#include <QtCore/qbasicatomic.h>
the error for qglobal goes and now the same error comes for qbasicatomic.h.
I think it is something simple like incorrect mapping between QtCore keyword and include directory or something..
Please do have a look.
The IDE is made on eclipse.
You can understand what is going wrong if you look closely at the error message:
/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h:45:28:
fatal error: QtCore/qglobal.h: No such file or directory
The error isn't in your inclusion of QtCore, but is occurring inside QtCore/qatomic.h, on line 45 (you can find this file in the [YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4/QtCore/qatomic.h):
#include <QtCore/qglobal.h>
qatomic.h is already in the QtCore directory, and you'll find a qglobal.h directory there as well. So what this means is that qatomic.h expects the parent directory to be on the include path, so that including <QtCore/qglobal.h> will work.
So you just need to add [YOUR BBNDK DIRECTORY]/target_10_0_9_1673/qnx6/usr/include/qt4 to your include directories.
Do it like this:
Right click over your project in Project Explorer and choose Properties
Expand the tree to C/C++ General / Paths and Symbols
Change the Configuration in the Paths and Symbols frame to [All configurations]
Click the Includes tag and select GNU C in the Languages list (or do this for every language).
Click Add... and type ${QNX_TARGET}/usr/include/qt4 and press OK
Click Add... and type ${QNX_TARGET}/usr/include/qt4/QtCore and press OK
Now your include of #include <QtCore> should work.
Next up: linking errors ;-)
It sounds like your BB10 NDK did not get installed properly, or your project wasn't set up properly. If you expand your project and the Includes you should see (along with others):
<NDK_INSTALL_LOCATION>/target_<VERSION>/qnx6/usr/include/qt4/QtCore

Problem in Cocos2d

I downloaded "cocos2s iphone-1.0.0-rc" and "cocos2d 1.0.0 beta template foe Xcode4"
and copy them to '/developer/Library/Xcode/Templates ' then open xcode and click on
new project ans see add 3more types of project (cocos2d,cocos2d-box2d,cocos2d-chipmunk)
and i create a project with cocos2d and doesn't add any code to it and run it but occur 6 errors,3 warnings in class 'CCTexture2D.m':
Font Manager undeclared ()
Assigning to 'CGSize'(aka struct
CGSize)from incompatible type id
method -sizeWithZfont not found
NSSTring may not respond to
'sizeWithZFont'
Incompatible types in assignment
Method 'drawInRectWithZfont' not found
i open Link binary With Libraries and can't find Cocos2d from list
and i add #import "cocos2d.h" in prefix.pch but doesn't work
Please help me to solve this problem
Have you installed cocos2d with the terminal, like this?
Run the 'install-templates.sh' script:
$ cd cocos2d-iphone
$ ./install-templates.sh -u -f

Compiling ffmpeg for iPhone SDK (Symbol(s) not found - Linker)

I'm using ffplay in my Application. I implemented the Librarys which has been used in this Project: http://code.google.com/p/ffmpeg4iphone/downloads/detail?name=ffplay-xproj.zip&can=2&q=
But I've seen that this Sources are very old(Apr 2009). I wanted to Build new Librarys and then change it with these In my project.
What I've done:
Downloaded the ffmpeg Source code: (using command line: svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg)
Compiled the Project with special ./configure options and the gas-processor :
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/076618.html
I only changed here the Paths of the actual locations for the iPhone SDK 4.1
Changed the header Path in xCode Active Target Project Settings to my ffmpeg folder
Included the .a files in my project in xCode
Added the Other Linker Flags -lm -lbz2 -lz
Tried to Build my Application, but I get some Linker errors where symbol(s) wasn't found.
Undefined symbols:
"avcodec_init()", referenced from:
And the other errors are nearly the same (_av_codec.....)
How can I build it correctly?
I've found the solution: I set the architecture to Optimized(arm7) and then all was working.
One more Question: I use ffmpeg for streaming an online stream. Which Values Should I set to get a good streaming quality also when I am in 3G. This what i've done:
set the audio-buffer to 1024
set the lowres value of mpeg to 3
Not sure if you are using C or C++ (g++) compiler, but try guarding your #includes for ffmpeg with extern "C": the c++ compiler (if it is used) is probably mangling the function names and hence the link errors.
Try to enclose your include with extern "C":
#ifdef __cplusplus
extern "C" {
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#ifdef __cplusplus
}
#endif