I've stumbled upon a problem trying to build a cross-platform app using cocos2d-x. Currently I'm trying to build for Mac OSX. I've tried linking to the boost header files but I keep getting errors stating boost/shared_ptr.hpp cannot be found. I'm only using the smart pointer headers.
I've added the root boost directory to Header Search Paths: $(SRCROOT)/../../boost_1_55_0 (non-recursive)
and the libs directory to Library Search Paths: $(SRCROOT)/../../boost_1_55_0/libs (non-recursive)
I tried this for both the root project file and cocos2d_libs project file with no good results.
I also tried adding to User Header Search Paths.
I've added them successfully on an SFML project, so does cocos2d-x bypass these search paths?
Thanks to anyone who is willing to help me!
Probably you have missed some step in your setup. Have a double check on every detail as you can go through these guidelines:
Porting a Cocos2d-x iOS game to Android
How to create a multi-platform project in one command line
This should help, as attention to detail if worthwhile.
I never figured out the problem, but I realise now that there's no need to even use boost. Cocos2d-x is compatible with C++11. What a relief.
Since XCode builds Cocos2DX projects for Mac and iOS you need to setup header search paths independently. Just switch target in XCode from iOS to Mac and set path to Boost for Mac build. Should work.
Related
Since I upgraded to Xcode 11 every new project I start that includes a framework can be no longer be compiled after the second build of the project.
For example including SDL2 using this command:
#include <SDL2/SDL.h>
will result in this error:
'SDL2/SDL.h' file not found
after the project has been compiled a second time.
Projects that have been created in Xcode 10 work normal in Xcode 11.
I tried changing the embedding options of the frameworks but no setting works. This error occurs in all Xcode 11 versions (0 - 2.1).
I am using macOS Version 10.14.6.
Why does this happen or how can this be fixed?
I hade the same problem with XCode 11.1. What I found out was that I needed to add the Header Search Path in Build Settings/Search Paths to:
/Library/Frameworks/SDL2.framework/Versions/A/Headers
And then it worked. It looks like the path is changed.
I finally found a solution. I added the frameworks with the menu in this screenshot to my project:
In Xcode 9 and 10 this did the same as adding the framework using this menu:
But now in Xcode 11 this isn't the same anymore. Adding the framework using the first menu will copy the framework from it's original path into the build folder of the project but for some reason Xcode does not copy the Headers folder in the framework. I think this is a bug but it seems like they haven't fixed it up to Xcode version 11.2.1 at least.
So now the solution to this problem is adding the framework using the Build Phases menu in the second picture.
SDL2 isn't a framework. Rather it is either a static or dynamic lib. Unless of course you are using some other custom made framework for SDL2.
There are two scenarios you would typically encounter:
SDL2 installed in the default location such as /usr/local
SDL2 installed in a custom place (which is how I do it)
I am guessing you are doing the former. If this is the case, it is possible that with Xcode 11 the default system header search path has somehow changed to not include /usr/local (or where you have installed it).
To fix this, you should first locate your SDL2 library. In particular where the include files are.
Then in Build Settings, go to Search Paths:System Header Search Paths and enter that path in.
Keep in mind the #include is using SDL2 as part of the path, so you do not want to put the SDL2 part in the path. Here is an example of my directory structure. So my path entry for this is $(PROJECT_DIR)/3rdParty/SDL2/include. You can see in my project directory, I have a 3rdParty directory which I use to hold the 3rd Party libs I integrate into the project.
You're using angled brackets for inclusion, which utilizes the system path.
Note you also may have to do update how you link against SDL2 (ie. it may not be able to find it).
I'm a total C++ beginner.
I'd like to compile this repository. I have qt-creator and all dependencies installed on my machine as outlined in README.md, although they may be newer versions in certain cases.
I'm unclear how to tell qt-creator where to find these dependencies? When I attempt to make StereoReconstruction.pro I get error messages related to an inability to find the dependencies.
I'd very much appreciate a boost on this. Any advice is appreciated !
It's good practice to avoid adding local machine-specific paths to source files of a community project. For Qt projects, add them in the additional arguments section of qmake settings in project build steps:
for include path, add INCLUDEPATH+=/path/to/include/dir, and for library path, add LIBS+=-L/path/to/library/dir
I am trying for hours now to find what on earth do I have to do in order to make Eclipse show proposals for the GTK+ 3.0 functions in C/C++. Does anyone have any idea how to do this? I mean on Netbeans I didn't do anything at all and it automatically gave me autocomplete suggestions with a little documentation.All I did is to insert the source file and the Makefile. In Eclipse haven't managed to add the Makefile that I made myself but I opened a new project with the source file only. Also I installed pkg-config but there was no luck with it for what I am asking for.
The information is extracted from this blog post:
You need to add the following paths to the "Includes" for the cross G++ compiler:
/usr/include/glib-2.0
/usr/include/gtk-2.0
what I would like to do is to have an application (I am currently working off the sample framework app) and include any ogre library files with it, as opposed to have it installed for the whole system. This way I can easily port the application onto other computers once built.
I am on Mac OS 10.9. I built Ogre by first running the CMake app to configure the Xcode project, then opening the created Xcode project and building the Install and SampleBrowser congifurations. A directory sdk/lib was created in the Ogre directory. This contains directories debug, OGRE and pkgconfig. The OGRE directory has all the samples .dylib files. What I do not see is the main ogre library file.
The contents of the file lib/pkgconfig/Ogre.pc suggest that there should be a library file called OgreMain in the lib directory:
Libs: -L${libdir} -lOgreMain -lpthread
As far as I understand it, I need this library file to be a part of my project. I could then link the sdk/include for all the Ogre's header files. I am confused about how to make this work. Could anyone please help?
Sounds like this is Ogre 1.8. In that case the libraries and frameworks need to be installed in your application bundle. Inside MyApp.app/Contents you will need folders named Components, Plugins and Frameworks. Ogre.framework goes in frameworks, component dylibs go into Components, plugin dylibs go in Plugins.
I actually found a great tutorial that worked straight away for me here: http://will.thimbleby.net/ogre3d-tutorial/
This is for Ogre 1.8, the only difference when using Ogre1.9 is that you don't use RenderSystem_GL.dylib but RenderSystem_GL.framework (found at the same place as Ogre.framework) and you deal with it in the same manner in terms of your project setup as with Ogre.framework.
I am new to the Mac OS X environment when it comes to compiling linux based libraries. Whenever I used a library i just downloaded the .framework file, added it to my /Library/Frameworks and included it in my XCODE project, and all was fine.
Now I am stuck with libnoise. I want to use it on my project and I have no idea how to generate the .framework file/directory.
Can you help me please?
If you have libnoise, most likely it contains some sort of a Makefile or a configure script.
By running the
./configure
make all
you will get the library file (libnoise.a) for your platform, the OSX10.8.
Framework is essentially a folder with specific layout and a .plist file. To generate such a folder automatically, you may create an expty Xcode project of the type Framework and add the libnoise.a you've just created as a linker's input.
There is a detailed instruction on how to create the Framework from static libraries (.a files): http://www.blackdogfoundry.com/blog/creating-a-library-to-be-shared-between-ios-and-mac-os-x/
You might be missing the header files in you framework, but then can be also added to the Xcode project from libnoise sources.
This SO answer may be of use also: Difference between framework and static library in xcode4, and how to call them
Apple's documentation is also good: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html
I'm not entirely sure if this is what was meant by "with a different fork and cmake"
but I got libnoise to run in my mac using this git repo.
https://github.com/qknight/libnoise