No syntax highlighting with SFML in Code::Blocks? - c++

As I learned C++ using Code:Blocks, I'd love to keep this one as my IDE, but I recently started using "SFML" and Code::Blocks does not seem to recognize SMFL classes/syntax, as shown in the picture. Is there any fix? (The SMFL itself works perfectly). Also, sorry for my terrible english (still learning it as well...).
Edit : Here's the picture :

If you want to use a graphical library in the C++ Code::Blocks IDE, you have two options: do the set-up manually, or use a pre-formed Code::Blocks project.
I will go over the former, since the latter (using the SFML preset) doesn't work on all machines.
Step 1: Create an Empty Project
When creating a new project, choose the Empty Project preset from the pop-up window.
Step 2: Add the header paths
Go to Build Options/Search Directories. Add the path to the SFML include file.
Step 3: Add the library (lib) paths
Now add the path to the SFML library file (lib).
Step 4: Link your project
Go to Linker Settings/Link libraries. Add the desired sub-libraries (by name, like so: sfml-librarynamehere, for example sfml-graphics).
That should do it. Also, keep in mind SFML provides online documentation for this king of things.

Related

Qt Creator - SFML Link to a console project

I am currently working on a project in console mode in which I wish to implement a sound. Our choice then turned to SFML, we get to install and use on OS X. However, we need to make it compatible with Qt project for rendering, I generate a.Profile and integrate our code and the library.
In OS X, no problem, installation and use possible. However, for this project, we need to integrate it into the code to make only archive. But every attempt to link our project with the aforementioned library, we run into errors.
Could you tell us exactly what files are to be included in the project? Working on protecting machines, we cannot install packages. Here is the screen of the integration window, the button exhilarating. We cannot select the Library.
You just have to use the external library instead of the internal.

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.

ArUco program from scratch

I'm using the ArUco library with OpenCV (more information here) but I can't find a way to build and run a program from scratch.
Once I installed the library I have access to different examples but if I want for instance to create a new file and add the library headers inside it, how can I compile and run it ? (with a command line or IDE, anything is fine)
Thank you
I sent and email to the library's author and he added clear instructions at the end of the project webpage :)
It seems you need to learn how to use your IDE's, compilation tools and general compilation basic stuff. This is not a question related to Aruco, or mostly any other tags you have set.
Try to lean CMake first, 'cause Aruco compilation is based on CMake: http://www.cmake.org/
You can start by just editing the aruco_simple example.
For a IDE that works right away with CMake you can try either Qt Creator >3.1 or KDevelop. Both free.

Adding an OpenGL framework in Xcode 4

I'm using Xcode 4 for my C++ programming. I want to add a framework, specifically an OpenGL framework, and I'm not quite used to where things are yet. It says in the help documentation that I should select the target, and from there I get the summery pane where I can add a linked framework/library. When I do that, the summery pane doesn't show up. It does show up when my target is a cocoa application, but since I'm programming in C++, I choose the command line tool, and select the language from there. So, how exactly do I add the OpenGL framework to my target?
maybe go under "build phases" (instead of "summary") and then click "Link Binary With Libraries" and add button then search OpenGL.framework
im not sure 100%, im new to this too :)
The easiest way is to go to your project settings, and under Linking -> Other Linking Flags add:
-framework OpenGL
In your project, create a group 'frameworks' (not really necessary but keeps things organized)
With Finder goto: /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks
Locate the OpenGL.framework folder
Drag and drop the folder into your XCode project (in the frameworks group)
Don't copy the files(!)
Probably you want to copy 'GLUT.framework' as well.

Beginner questions regarding to "building a library", in Xcode on iPhone specifically

I have never been clearly understand all these linking/building/dependency business. Now, I am trying to build the FreeType library (which is in C++), into the *.a library file for the iPhone (because another library I am trying to use, openFrameworks, would depend on FreeType).
I know that to compile C++ with iPhone I simply need to rename *.cpp to *.mm. (I have tried with some simply programs in main() and it works) But how can I build the library in Xcode then ? (without the main() I suppose)
On the other hand, it would be great if you guys could recommend some books or documents on such linking/building topics, which I found myself most confused about.
PS. I have already got the paid version of Xcode and some sample apps compiled onto the iPhone.
Renaming .cpp files to .mm would mean they'll be treated as Objective-C++ code rather than C++ code. I don't think that'd be a good idea, even if it should still work. Besides, FreeType is written in C, not C++.
Google for "compiler linker" and you'll find quite a few documents on how they work. That should help for documentation.
It's entirely possible to compile static libraries for the iPhone; what you can't do is compile dynamic libraries or frameworks - you could, but it's not encouraged.
Open your project
In the source/target browser, select the "Targets" node (with the little red and white target icon).
Right-click on the node, and in the popup menu select "Add", followed by "New Target".
A dialog opens. On the left hand side, there's an iPhone OS and a Mac OS X section. The iPhone OS section should already be selected; if not do so.
You should have three choices of targets, one of it is a static library. Select it, click OK.
Give the library a name in the next page. Click finish.
Your "Targets" node has includes a child for your static library now. You can add sources either via the file menu, or by dragging it onto the "Compile Sources" child node.
Hope that helps.
First, you do not need to rename any files to compile C++ code for the iPhone. Secondly, you'll want to create a separate project for the library. It looks like the iPhone target types don't include "static library", so you might need to create a Mac OS X project and modify it to output an ARM .a file. Not trivial, but probably doable.
Alternatively, if you're not going to be using this code in a lot of otherwise unrelated projects, you could include the source files directly into your App project. Collect them all into their own group, and you'll hardly know they are there.