i am getting this error it si hard to explain thats why i am attaching the image
this error accure when i am adding I class Base64.h
Most likely, the file Base64.m is not properly added to your project. It doesn't get compiled so it's missing when the final image is being linked.
Make sure the file Base64.m is the same kind of project member as FirstViewController.m (similar location, similar settings etc.).
i found the solution it is amy just a trick but i create the both base64 h and m files again with different name and then use it that time it works
thank to you
Related
I am facing a critical problem here, Xcode throws strange exception while building it's
"
duplicate symbol _selected in:
/Users/mhgaber/Library/Developer/Xcode/DerivedData/اProject-Name-aopcbghvorqhdwbyudzqsyhtekcu/Build/Intermediates/Project-Name.build/Debug-iphonesimulator/Project-Name.build/Objects-normal/i386/ClassX.o
/Users/mhgaber/Library/Developer/Xcode/DerivedData/Project-Name-aopcbghvorqhdwbyudzqsyhtekcu/Build/Intermediates/Project-Name.build/Debug-iphonesimulator/Project-Name.build/Objects-normal/i386/ClassY.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I searched a lot but I didn't find anything help me please
Look at both the files for ClassX and ClassY - What targets are they included in? Basically the _selected method is duplicated in both of them. I am going to guess this is a plain C method that happens to be named the same in both files. Try renaming _selected in one of the files.
In my case, I was declaring a const in a header file, which worked fine when building and running on the device (iPhone 5), however when attempting to simulate a 4S, all of a sudden I had some 300 "duplicate symbols".
It turns out I needed to also mark the const as static and the issue went away. Presumably it was trying to redefine the constant every time the header was referenced. The compiler isn't smart enough to just make constants static? Didn't think that would be necessary, but I guess it is.
const CGFloat kTitleAnimateDistance = 50.f;
Needed to be:
const static CGFloat kTitleAnimateDistance = 50.f;
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.
I was having the same problem and #dtrotzjr 's answer gave me a hint as to what could be causing it.
In my case I had a plain C void function in my framework (which xcode was complaining about as a duplicate symbol) and i needed to declare it as static void
I had the same issue. I was including a .h file with a number of const strings, methods and a struct. When I changed them all to static except the only mutable variable I wanted, it compiled just fine.
I got this error when i tried to build:
"duplicate symbol __Z8ERRCHECK11FMOD_RESULT in:
/Users/codemenmini2012-2/Library/Developer/Xcode/DerivedData/MagicSleepFullVersion-agxulkdijnxbqmbuigucmrczufyw/Build/Intermediates/MagicSleepFullVersion.build/Debug-iphonesimulator/MagicSleepFullVersion.build/Objects-normal/i386/MagicSleepViewController.o
/Users/codemenmini2012-2/Library/Developer/Xcode/DerivedData/MagicSleepFullVersion-agxulkdijnxbqmbuigucmrczufyw/Build/Intermediates/MagicSleepFullVersion.build/Debug-iphonesimulator/MagicSleepFullVersion.build/Objects-normal/i386/MagicSleepViewControllerIpad.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
How to solve this guys?
The error may occur when you copy and paste the contents of one file to another file with its interface name which means two classes with same interface name.
In your code you have two different files with the same Interface name.
For me this error happened because I was dumb enough to copy the whole folder of a downloaded lib to the project and there was a demo project inside it. So I had two main.m files. Hope this helps anyone!
In my case I had accidently imported .m file instead if .h file. Hope it helps someone for this kinda silly mistake.
when you create bool variables with same name in two different classes then this error comes.
"duplicate symbol __Z8ERRCHECK11FMOD_RESULT in"
so check your both classes
MagicSleepViewController.m and
MagicSleepViewControllerIpad.m.
for same bool variables.
Change the bool variable name, your problem will solve.
Looks like you have at least one (probably more) symbol (or methods, functions, etc.) that's duplicated between MagicSleepViewController.m and MagicSleepViewControllerIpad.m.
You need to either 1) change the names of one set of duplicated methods or 2) figure out a way to merge MagicSleepViewController.m & MagicSleepViewControllerIpad.m so the same code will work on both iPhones and iPads (e.g. using run time conditionals or whatever to determine what kind of device your code is currently running on).
I had #defines placed in two files that were exactly the same... DOH.
For me, a search in the finder for the named duplicates has helped.
The problem in my case was caused due to multiple references in the "Compile Sources". So I deleted one from Project->Build Phases-> Compile Sources.
I'm new to iOS Development, I'm using the latest version of Xcode and just got an error that said Apple Mach-O Linker (Id) Error exit code 1 and I haven't got a clue why. I think this is relevant but I'm not sure what it means:
ld: duplicate symbol _OBJC_CLASS_$_Timing1ViewController in /Users/tomkenning/Library/Developer/Xcode/DerivedData/EggTimer-ciznfdheqrtybuavrtbbcxfywyyw/Build/Intermediates/EggTimer.build/Debug-iphonesimulator/EggTimer.build/Objects-normal/i386/Mediumhb.o and /Users/tomkenning/Library/Developer/Xcode/DerivedData/EggTimer-ciznfdheqrtybuavrtbbcxfywyyw/Build/Intermediates/EggTimer.build/Debug-iphonesimulator/EggTimer.build/Objects-normal/i386/Timing1ViewController.o for architecture i386
All I've done recently is initialise and set some integer values in a .m file and then link to them from .h file from another ViewController, using #import "suchandsuch.m", there's been no errors in the code, but is that not allowed?
Thanks in advance for any help you can offer!
Don't do this:
#import "suchandsuch.m"
Do this:
#import "suchandsuch.h"
You are probably compiling suchandsuch.m, which defines the class Timing1ViewController, normally (by including suchandsuch.m in your target's list of files to build). Then your #import "suchandsuch.m" causes that same code to be inserted into a different source file, which is compiled as well. The result: two different source files try to define Timing1ViewController.
To do your constants the right way -- by declaring them extern in suchandsuch.h and defining them in suchandsuch.m -- see this answer.
You probably have two Timing1ViewController classes with the same name. If you don't try to Product -> Clean and build again.
I'm trying to port the speakhere example into another app and I'm having issues. I copied all the files, and all the frameworks, but for some reason I get a bunch of compile errors that I've never seen before and thus don't know what to do. The only difference is that i'm not suing IB and so i had to change it slightly.
What does error: expected '=', ',', ';', 'asm' or '__attribute__' before 'foo' mean?... I get this error multiple times for different files
In my situation the first error is pointing at 'MeterTable'.. a class that includes <stdlib.h>,<stdio.h> and <math.h>. But those files seem to be importing fine (if i remove them i get more errors)
Any suggestions on how to debug this?
TIA!
EDIT:
I still can't seem to figure it out. I'm literally just copying files from the example into another project. Can someone check it out please ? SpeakHerePort.zip and the original is here SpeakHere.zip
Your problem is that you are compiling SpeakHerePortAppDelegate.m, which is an Objective C file, but it is indirectly including MeterTable.h which is a C++ header file.
Rename it to SpeakHerePortAppDelegate.mm (double m) so that it is compiled as Objective C++ and your problem is resolved.
Name all your files .mm and then all your code will be compiled as Objective C++
In my case, the .h and .m in question are built fine with regular target, and the App can run as well.
However after the subset of the files are moved under a static library target, it gets this compile error when the static library is built.
Was stuck for a while & tried the above mentioned techniques, unfortunately they didn't help in my case.
Noted that this error happened only for the NSString*, for e.g.,
extern double const kTimeout; // fine
extern NSString* const kImageType; // compile error
After the above analysis & little break, eventually the problem is resolved by adding the the following import to the .h - "Foundation/Foundation.h"
It sounds like an unfinished declaration, probably in a header file. Search for 'foo' (or whatever the symbol actually is) across all project files, using ⇧⌘F (Edit ▸ Find ▸ Find In Project...) in Xcode, and/or examine the headers you're including where MeterTable is declared. Sometimes the compiler gets confused about the actual location of the error, since header files are frequently #imported into other files, so the problem can be manifest in multiple locations.
This might not have applied to this exact situation, but I had this exact error too, which was caused by a bad forward declaration. In Objective-C, make sure your forward-declares begin with the # sign - e.g.
#class MyClass;
Those of us still on autopilot from C++ will forget the #, see that XCode has highlighted class as a reserved keyword, and think all is well with the world. It is not.
It means that you have a syntax error. If you paste the code in question, it's easier to debug.
I had a similar scenario to some of the posts above. I'd written a C++ class based off of the examples in the Audio Queue Services documentation, and had this compilation issue in a test project. This post helped a tremendous amount.
Today, I'm incorporating the C++ class in my project, and got the build error again. In my scenario, I had to also set the type (using the "Get Info" window) to sourcecode.cpp.objcpp for the objective-c class that was calling my C++ class.
I'm trying to use in an Xcode (iphone) static library, and can't figure out this error. Anyone else had this before?
It borks in the file stl_algobase.h at these places:
__glibcxx_requires_valid_range(__first, __last);
I've tried using GCC 4.0, but it always includes from here:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:606:0 '__glibcxx_requires_valid_range' was not declared in this scope in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h
Andrew
It's likely that your project contains a header file that shadows a system header file.
If you have a header called "debug.h", try renaming it to something else and recompile your project.