I keep getting errors upon building my application on Xcode:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
None of my code is erroring and the errors are weird errors and anything I do does not resolve it. I don't think the code is relevant to the issues because it isn't referenced in the error.
This is a screenshot of the error.
The linker has not been able to find any file in the linking process with the main swift entry point. This can be due to the file not existing at all in your project, or that it exists but has not been included in the compile or link build phases.
In Swift, the main swift entry point is defined in a main.swift module, or (for iOS) in the AppDelegate.swift file there needs to be a #UIApplicationMain declaration. I don't see a Compile main.swift in your log, perhaps its missing or not included in the build phases?
Just in case, check if your AppDelegate app target is selected on the File Inspector.
( Select AppDeletage > Show the Utility > Show the file Inspector > under Target Membership, select your target.)
It happened to me after renaming an existing file.
Some time remove the reference of AppDelegate.swift from the project and add AppDelegate.swift again in project will work.
Related
Building failed with Xcode 13beta for React Native 0.64.2 project. It is on macOS Big Sur. The detail of error is:
Undefined symbols for architecture x86_64:
"__swift_FORCE_LOAD_$_swiftFileProvider", referenced from:
__swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit in libYogaKit.a(YGLayoutExtensions.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftFileProvider_$_YogaKit)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What configuration change is needed to eliminate the error?
Create an empty swift file (####.swift) from Xcode in the main project which located Appdelegate.h file. This worked for my React Native project after Xcode version 13 update.
Try creating a new Swift empty file (it's not necessary to create a Bridging Header).
Adding libswiftWebKit.tbd into Link Binary With Libraries build phase in XCode helped to solve the problem:
enter image description here
I make a build for iPhone for the first time and got a problem.
I already checked a lot of posts and didnt find answer.
When i make a build on device a get:
Undefined symbols for architecture armv7:
"RegisterAllStrippedInternalCalls()", referenced from:
RegisterAllInternalCalls() in libiPhone-lib.a(MonoICallRegistration.o)
"RegisterAllClasses()", referenced from:
InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)
"RegisterMonoModules()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On simulator ok.
libiPhone-lib.a added to link libraries.
Can somebody tell what it is? Please
Your unity version is not compatible, just download the latest version of unity which I believe is 4.3.1 and try recompiling. Here is the link if you need it. http://unity3d.com/unity/download/download-mac
The new version is compatible with armv7.
ok if anyone else is experiencing the same problem here's a way out:
those 3 methods mentioned are declared in the RegisterMonoModules.cpp in the Libraries folder, usually. so take that cpp file and add it to your target's Build Phases > Compile Sources
then if you have additional SDK's integrated that are not added to the 'Compile Sources' the new build will throw some other errors. just make sure to add the wrapper .mm files from the sdk's to your Compile Sources. Usually one .mm file per sdk. (e.g. for unity facebook sdk it's FbUnityInterface.mm file)
hope this helps
I'm getting the following two errors via xcode:
Warning: no rule to process file '$(PROJECT_DIR)/SQLite Toolbox/en.lproj/MainWindowController.m' of type file for architecture x86_64
Followed by:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MainWindowController", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
Previously my project was building just fine, but I attempted to do some localization. I had my MainWindowController.xib highlighted and choose the localize option.
After that, the project stopped compiling. It looks to me that for some reason XCode is refusing to compile my MainWindowController.m, but i'm not sure how to go about fixing that. (I have confirmed it does exist in the Build Phase Compile Source steps.
Any ideas on how I could fix this?
That sounds as if you inadvertently have localized the "MainWindowController.m" file.
The following steps worked in my test project to fix that situation:
Remove "MainWindowController.m" from your project (using the "Remove Reference" option!)
In the Finder, move "MainWindowController.m" from the "en.lproj" folder back to the main folder.
Drag "MainWindowController.m" onto the Xcode project to add it again.
I created a command line application. Then I realized it would be handy to be able to use code in other projects, so I added a new target - a cocoa library.
It seems to compile and a .a file is generated.
Now in another project I want to use this library. So first I added the first project to this new project as a reference.
In build settings I set "Always search user paths" to YES, then keyed in the path to the above project in user header paths.
In build phases, "Link Binary with libraries" , I added the .a file.
Now in my new project code sense seems to work. But when I try to build, I get an error : ndefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RIImageSplitter", referenced from:
objc-class-ref in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What did I do wrong? :S I am a beginner.
Didn't add file to compile sources of target. =S
Check this:
Did you drag the static library to your project navigator?
Did you add in Target/Build Phases/ Target Dependencies?
Did you add the Header Search Path for the headers of the static library?
Good Luck!
I have a problem with my unit tests in XCode. I have an active target which directly depends on a UnitTests target. I have generated some code with ProtocolBuffers library and I have added these classes together with ProtocolBuffers project to my project. Everything compiles well in the active target, however in the UnitTests target I'm getting the following error:
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_CRequestMessage", referenced from:
objc-class-ref in CConnection.o
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
I had noticed that the generated m file is not added to the UnitTests target so I added this file to the target. Now I'm getting over a thousand errors, including:
(...) ../ProtoBuff/Classes/CodedInputStream.h:27: error: cannot find interface declaration for 'NSObject', superclass of 'PBCodedInputStream'
NSObject is not visible?
Of course before adding the generated code everything had worked and compiled well.
Any ideas how to deal with this?
Thanks!
Did you add "ProtocolBuffers.h" to your target?