Trouble setting up SFML in CodeBlocks - codeblocks

Tried to add the SFML library but I get an error:
cannot find -lsfml-graphics-d / -window-d / system-d
and I don't know what to do.
In the Debug Linker settings, I have this:
In the Release Linker Setting I have this:
And this is the error:
And I only changed this:
and this:
Nothing more.
I am new to libraries and things like that so please if you can explain the things I have to do to repair this. Thank you and have a nice day

Go to the sfml file and then double click on it. When you double click on it, you should see bin, doc, examples, include, lib, license.md, and readme.md. Double click on bin and copy all of the files to your project folder. This should help fix the errors.

Related

Can't get real path for source - Xcode, SFML, C++

I am new to SFML, and followed SFML & Xcode tutorials for SFML 2.5 to try to get a basic program build and run.
After copying the content of Frameworks to /Library/Frameworks and content of extlibs to /Library/Frameworks, and the Xcode templates, I was able to create a sample app via Xcode using the SFML App template.
When I tried to build it, it failed with the following error:
Any idea what I did wrong?
Help is much appreciated!
Seems like a post build script is pointing to incorrect paths. Here's how to fix this.
In Xcode click on your project's name in the root of the project navigator (where you see the source files) so you can see its configuration.
There should be a header called "build phases". Click on that.
Expand the item called "Run Script".
If you followed the tutorials from SFML to setup your environment, edit the area under the comment "Settings" at the top of the script to look like this.
#These 3 are probably pointing to a directory under
#/Users/SFML right now which is not on our machines
SFML_DEPENDENCIES_INSTALL_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_FRAMEWORK_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_LIB_PREFIX="/usr/local/lib"
#This Doesn't Change
FRAMEWORKS_FULL_PATH="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/"

SDL and SFML not working with Xcode 5

I got used to VS quiet well, but hopped to Mac. OS X is fantastic, and I'm playing with Xcode now. I do not like it... For Apple related stuff it is great, but God, SFML and SDL are not working! I got same problem with both! I installed Command line Tool, and installed both Frameworks and everything, made templates, but when I build my main.cpp, it get's broken in same place. On the line #import <Foundation/Foundation.h> it says can't find Foundation/Foundation.h, and I tried adding path, and fiddling all the things in build phase, but still nothing. It is so frustrating! I can't wait for JetBrains to release their C++ IDE. Can anybody help me with these? I tried recompiling SDL2, since it was crashing Xcode but then I got that Foundation.h is missing. SFML is showing me the same thing, even if I created template and everything else is perfect. Can anybody help me?
It sounds like you need to add Foundation.framework to your Xcode project. To do that:
Click on your project's icon in the Project Navigator pane. This will show you the various targets in your project. (There's probably only 1 if you've just made the project.)
Click on the target you're trying to build, then click the "Build Phases" tab.
Twirl open the section named "Link Binary With Libraries" and click the "+" button. It will display a dialog with a list of the standard frameworks. There's a search box at the top. You can just type "Foundation" and it will find it.
Select it, and click "Add". That should add it to your target.

xcode error Lexical or Preprocessor issue

I am trying to follow this tutorial and am encountering this error. If somebody could help me it would be much, much appreciated.
Thanks.
That header is probably not in your project navigator in xcode, You need to find the file in finder and drag it into xcode and place it in your project navigator
A few options I can suggest:
Add the framework part of the path #import <SMTPSend/NSData+Base64Additions> (also if this is a framework, you should probably use these enclosures: <.../file.h> instead of quotes)
Add the frameworks path to your build settings ( Framework Search Paths )
Make sure the framework is in the Link Binary With Libraries section
Remove the framework reference from the project organizer pane (cmd+1), then drag it back in (refreshes the path for the file)
Clean/Clean Build Folder/Rebuild
Hope one of those helps!

Xcode IB Can't Read Archive?

I just created a new project from a template and when I try to build the project I get a "Could not read archive" error for each nib file from the compiler. I did some Googling but could not find an explanation or steps to debug. Has anyone run into this error before or can someone explain what it means?
When I try to open the nibs with Interface Builder I get the same error in a pop up.
I'm an idiot. Project name included an ampersand '&' character. Reread the Nimble Kit Coding Examples. and saw the little warning against using special characters "especially '&'" near be bottom of the Xcode compiling error segment in order to figure this one out.
I tried a bunch of things that never worked. I finally solved this issue by simply deleting the item out of XCode (just remove the reference..DO NOT..I REPEAT..DO NOT move it to the trash!!). Then, Add the file back into the project by Selecting "File" - "Add Files" or right clicking some folder in the Folder Navigator view and selecting "Add Files". I then cleaned the project just to be on the safe side and after that I built the project and it worked!

Xcode: code loses syntax coloring

I find that in various situations Objective-C code in Xcode 3.1 (Leopard) can fail to get appropriate syntax coloring after typing or lose coloring that it had.
This isn't just a "refresh" issue with new custom symbols -- but affects Cocoa framework symbols as well.
Sometimes CMD-a to select all text on the code page will make the coloring (re)appear, sometimes double-clicking on a line to select it will work, sometimes I have to add/delete a space in a symbol to get that symbol to (re)color. Rebuilding, or closing/reopening the project may or may not work.
Is this a known issue with Xcode? For something so annoying to me, I'm not finding the plentiful discussions of it on SO and elsewhere I'd expect.
And is there any command to force global syntax recoloring?
1.) Go to Project --> Build Settings --> Header Search Paths
2.) Add "$(SRCROOT)/**"
3.) Close and reload the project
4.) Go to Xcode --> Window --> Organizer --> Projects --> $YourProject --> Delete Derived Data
5.) Wait a moment until XCode rebuild all indicies
To get more information activate verbose logging:
1.) Increase Xcode log level in Terminal app:
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
2.) Open Console app. Search for "xcode"
3.) I saw "file not found" errors for header files mentioned in the pch file (therefore the fix above)
I had the same issue with a project that was fine in Xcode 3 and for which the syntax highlighting and code completion has broken in Xcode 4. It took me the better half of the day to figure it out but I found that the following steps will reproduce / fix the issue 100% for me.
After trying all the aforementioned solutions to no avail, I tried creating the project from scratch and reimporting every file and folder painstakingly. Every time I imported a couple of files I checked and syntax highlighting still worked. Even after the last few of them it still did. Then I hit build which failed because I forgot to include a couple of common header files in the project .pch file that were there in the old project. And that was when CodeSense broke again.
After further investigation we found that if you import a header file that in turn imports the same framework header file than the .pch already does, then CodeSense will break. The same setup did not cause any issues in Xcode 3.
Example:
project.pch
#import <Foundation/Foundation.h>
#import "projectConfig.h"
projectConfig.h
#import <Foundation/Foundation.h>
#import "one.h"
#import "two.h"
So by removing the wholly unnecessary
#import <Foundation/Foundation.h>
directive from the 'projectConfig.h' you can fix the highlighting and code completion will come back for you as well. If your issue is the same as mine that is.
Just select the file who lost the syntax coloring , press Editor > Syntax Coloring > ( choose your language (Objective c++ for ex) instead of 'Default'
I have found the best way to regain syntax coloring is just to quit Xcode and re-launch it. I couldn't tell you why, but that works every time.
I find that the following will often do the trick…
"Reselect" both "Base SDK" - and "Architecture" - in "Build Settings".
(CLick on blue project icon in top left, while in "Browser mode", aka ⌘1, then click project settings and mess with the stuff there.
Make sure they all line up / it doesn't hurt to do a little toggly-wogglying up in there, while you're in there… ya know just mix it up a bit. You'll notice xCode has a teensy-tiny mini-stroke - every time you switch between 64 and 32 bit… This is usually when I know if code highlighting is dead for the night, or if I'm good to go.
Often, I will have a project that gets highlighted instantly in 32 bit mode, and just sits there in 64… Who knows.. Ahh, Xcode, you wacky botch.
Select your Project -> Build Settings tab -> Apple LLVM Language 5.0 -> Precompile Prefix Header to YES. NSLog was not highlighting. Currently running Xcode 5.0.1 Hope it helps =) Thanks #rebelzach
I can confirm a 100% fix for this problem, based on a question I had asked (and actually answered), as pictured below. One thing i will add is that sometimes it is "errant whitespace" that can also contribute to the loss of highlighting. Either clean it up yourself, or use the Goggle Toolbox for Mac Xcode 4 plugin, which adds an entry in the XCode Edit menu called Clean Up Whitespace.
This appears to be a similar error from this question
I was able to correct this issue by setting Precompile Prefix Header to No in the build settings.
I recently had a similar issue, all coloring and autocomplete stopped working for built-in frameworks, my own classes still worked. Someone recommended to me that I turn off "Run Static Analyzer" in the build settings. It's weird, but it worked.
For me it was that I renamed my project, and Tests target was still pointing to the old pch location, but my App target was pointing to the new one.
If your app delegate still has code sense, this might be the case for you too. Go into project, select the 'Tests' target search 'prefix' and set it to the equivalent value in the 'app' target.
Open the project settings (Project > Edit Project Settings menu) and then click the Rebuild Code Sense Index button in the General tab. This will recreate the index that Xcode uses for syntax coloring.
This process can take a while for larger projects, so you can check the progress in the Activity window (Window > Activity menu).
Moreover, in XCode4 there is no button to rebuild the code sense index.
I had the same problem and solved this by updating my build settings to use the system default compiler, LLVM GCC 4.2.
It seems there are multiple factors.
I experience this issue as well, and have tried the solutions either "rebuilding the index", "relaunch XCode", "change the compiler setting to LLVM GCC 4.2". Those didn't help me out.
So I tried to add the following code right away along with the fresh creation of header file.
#include "header.h"
using namespace cocos2d
Then, the code added earlier in header file is colorized, and it can recognize classes and stuff.
I've used cocos2d-x, so my syntax is based on c++. I don't test it with Objective-c yet though.
For someone still have don't know why. Let open with XCode 8.2, it should work

Resources