Learn Courses My Dashboard

Error main and architecture x 86 64

I always get the following 2 errors, which I haven’t been able to solve yet. can you help me, please? it’s:

Entry point (main) undefined. for architecture x86 64

and:

Swift Compiler Error Group: /Users/Julia/Desktop/HelloWorld/HelloWorld/AppDelegate.swift:11:2: Unknown attribute ‘main’

image

@Anna-Julia
Hi Anna,

Welcome to the community.

Just so that we have an idea of your Mac environment, can you tell us what year and model you have, what operating system version you have (Catalina, Big Sur or earlier) and what version of Xcode are you using?

OK, on closer inspection it looks like you have Xcode 12 and it also looks like you have created a Storyboard App.

What did you do in your storyboard in terms of configuring the objects in your ViewController?

Perhaps you can take a screenshot of your Xcode window with your Main.storyboard selected. It should look something like this I would expect.

Ok. I try to answer, but bear with me, I am no computer wizz. I have a MacBook Air, which might be 4 or so years old. I started with XCode 8 and Swift 3, did a project, left frustrated, decided to start again this year … and everything has changed.

Then I deleted my projects and updated Xcode to 12 and Swift 5. Now I start all over, but the error keeps bugging me.

@Anna-Julia

It looks like you have only just started as there is nothing in your storyboard View Controller. What code (if any) have you placed inside your ViewController.swift file?

The trouble usually starts right from the beginning when I want to create a new projekt.

This shows up in AppDelegate.Swift:

and then we get this beauty:

and then we get this beauty:

Even, when I just edit out the @main like that: //@main
the architecture error stays

and this is in the build settings

The contents of the AppDelegate file you are showing me is absolutely normal.

The AppDelegate and SceneDelegate files are system files and under general circumstances you would not need to place any code in either of them so as long as they have not been modified in any way the issue you are experiencing is caused by something else.

If all you have done is create the project and then run it on the simulator you have chosen without adding any code whatsoever and this error has occurred then that is very unusual.

I had some images from an old project in Xcode, maybe it did not like the structure, but I deleted the project. Still no change.

I am already thinking about resetting the whole thing. But since I want to use the images, the trouble will reoccure.

How did you add the images? Did you drag them in and drop them in the Assets catalogue (the file names Assets.xcassets)?

yes, correct

OK can you post a screenshot of the Assets catalogue contents? I can’t imagine dragging an image in would cause an issue.

you see, it’s empty. I deleted the project and saved it on a thumb drive

you see. I have nothing there.

Given there are no images then that can’t be anything to do with it.

Can you create a new project and name it something different then Click on the Play button up the top. It should build successfully and launch in the simulator. You should get a blank screen in the simulator.

That dialog box shows that you have previously created a project named HelloWorld and one named Hello.

ok. I’ll do. Interestingly, the “Hello” project is working but I created it a couple of days before and edited out the @main in AppDelegate.swift

I’ll try a new one. one moment

Hi Chris,

seems that I have had exceeded the post limit of the day. That’s why I could not answer anymore.

I did a new project, but:

same issue

Ah yes, that’s one of the problems with having a free Developer account. You are restricted to creating 10 Apps in a 7 day window so the only way around that it to reuse the Apps that you have created rather than throw them in the trash. Not a simple option when you are having the issues that you are.

I would be very interested to see what might be wrong with your App that you have created. Would you mind compressing the App into a zip file and post it to Dropbox or to Google Drive and share a link with me in a reply. If you have never compressed a folder into a zip file or used DropBox or GoogleDrive then what I am asking probably makes no sense at all but let me know.

Test.xcodeproj.zip