how to fix these errors in xcode? - ios

I finished my game but when I hit run, i'm getting these errors:
I need to change "JohnsPC" to my name!
ld: warning: directory not found for option '-L/Users/JohnsPC/Desktop/Logo Mania?/Code/Yeah/PuzzleGame'
ld: library not found for -lChartboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And the second error I have no Clue
How do I fix these?

check the target - Build Settings -> Library Search Path and set proper path for library on your mac
also use macro $(SOURCE_ROOT) to avoid this kind of problem

Try this :
Go to Targets -> Build Phases -> Link Binary With Libraries
Click on + symbol & press Add Other
Select your library

Related

How to fix the error "duplicate symbol _LOG_BUFFER_LENGTH"

I have a Unity project embedded into Swift 4 and when I build the project I get an error from a plugin named FFmpeg (used to record the screen) and the error is next:
duplicate symbol _LOG_BUFFER_LENGTH in:
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/cmdutils.o
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/ffmpeg.o
duplicate symbol _LOG_BUFFER_LENGTH in:
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/cmdutils.o
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/ffmpeg_wrapper.o
duplicate symbol _LOG_BUFFER_LENGTH in:
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/cmdutils.o
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/intercept.o
ld: 3 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I want to specify that if I export the project from Unity to Xcode without to embed it is working perfectly with this Plugin.
What can be the problem with this error ?
Until now I tried next thing to remove the error but none helped me:
I checked if I have "-ObjC" in Xcode in "Other Linker Flags" and I don't have.
I removed a duplicate library (“libil2cpp.a”) from "Link Binary With Libraries" (XCODE)
I changed 'No Common Blocks' from Yes to No (under Targets->Build Settings->Apple LLVM - Code Generation )
At the end I have the same error.
Here is a print screen:
Thank you so much if you spend your time to read this and any idea will be helpful.
For me this helped:
Step 1: Go to TARGETS -> Build Settings -> No Common Blocks -> No
Step 2: Go to TARGETS -> Build Settings -> enable testability -> No
Additionally you can check Build Phases -> Compile Source. Check duplications.

library not found for -lHKDisplayModel clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: library not found for -lHKDisplayModel
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This error is because of some missing libraries in your project.
Check in your Build Phases -> Link Binary With Libraries. Any of your framework may had been removed from there.
If you have imported any files into project then check .m (main) file for same does exists in Targets (Project Name) -> Build Phases -> Compile Sources.
If file does not exists then include it using (+) Add button shown. Also, if duplicate files exists (if any) then delete it.
Also check in Build Phases -> Copy Bundle Resources, if any file is displayed in a red color, then remove it and add it again.
Now press cmd+shift+k to clean the project. New Build should not display this error.

Xcode 7 build failed: ld: library not found for -lGoogleAnalyticsServices

Every time when I open my app with Xcode I get this error:
ld: library not found for -lGoogleAnalyticsServices
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Then I need to unmark the target on the libGoogleAnalyticsServices.a file and mark it on again. After the uncheck/check of the target the app runs normally...
I get 2 other warning when this happens:
ld: warning: directory not found for option '-L/Users/vision/Documents/Apps/Mijn Cijfers/Mijn'
ld: warning: directory not found for option '-LCijfers'
Now this looks like Xcode can't read spaces and looks for a new directory called Cijfers. My app is called: Mijn Cijfers, but I never had this problem before with spaces in my project name.
Every time when I check/uncheck the target of libGoogleAnalyticsServices.a the Library Search Path is adding new rows:
I think both cases has to do something with the warnings and errors that I get. It's really annoying to remove the Library Search Paths and check/uncheck the target to let my app run normally. -.-
Does anyone know a solution to solve this odd bug?
You need to delete all these path except the "$inherited" and then add Google Analytics library path (Drag the folder where you saved the library).
If you follow this then you don't need to recheck/uncheck the library path.
If you have just created pod file by running $ pod init command in terminal,
then just close project and Open projectName.xcworkspace instead of projectName.xcodeproj
which will not throw error -lxyzLibray eg. -lJSONModel not found.
Now compile and debug again It will work.

Linker command failed: duplicate symbol for architecture i386

I added the XYPieChart folder into my Swift project on XCode 6 but now I'm getting this "Apple Mach-O Linker Error":
duplicate symbol _main in:
/Users/ansariha/Library/Developer/Xcode/DerivedData/Juxta-bjrfrzoyetsowibjdgpcxtesgwtg/Build/Intermediates/Juxta.build/Debug-iphonesimulator/Juxta.build/Objects-normal/i386/AppDelegate-EE692B7EDFB39C7A.o
/Users/ansariha/Library/Developer/Xcode/DerivedData/Juxta-bjrfrzoyetsowibjdgpcxtesgwtg/Build/Intermediates/Juxta.build/Debug-iphonesimulator/Juxta.build/Objects-normal/i386/main.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Below that it says "1 duplicate symbol for architecture i386" and then below that, the error: "Linker command failed with exit code 1 (use -v to see invocation)".
Has anyone ever seen this before?
Go to your project Bundle in xcode -> Build Phases -> Compile Sources
Check whether one of the files are added twice or not. This might be the case where such things happen.
Your AppDelegate might be added twice. Remove one of them.
Updated:
Some time you accidentally importing the .m file instead of the .h due to which this error comes. Please check and If this is not the reason, then perform the following steps
1- Check Build phases in Target settings.
2- Go to compile source section.
3- Check if any file exists twice or once.
4- If file exist twice delete one.
5- Build again.
This error occurs duplication of file in your project. click on The Project Navigator and search Duplicate file. in your project duplication of Appdelegate class or main. Remove one of file from your project.

Put Xcode files into new folder. Since then, I encounter the following errors when building project in simulator

I encounter the following errors
ld: warning: directory not found for option '- L/Users/andrecowardjr/Desktop/Parley/Parley/Google Analytics
ld: library not found for -lGoogleAnalytics
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cant find out what the error is. Help needed.
Go into your project settings, check out the field 'Library Search Paths', and edit it so that it reflects where you moved your code/libraries. The error you're running into here is the linker can't find the Google Analytics library that your app is set up to link against (because you moved it).

Resources