Struggling to get started in Visual Studio and Xcode - "undefined symbol _main" - c#

I am a beginner when it comes to coding, and I have been struggling with a very annoying problem this entire day. I hope you can help me relieve this awful headache.
My idea is to create a very simple app for my Mac, so I downloaded Visual Studio and Xcode.
I followed this tutorial from Youtube to get started, but halfway in the film I see that I am not able to get the same "outputs" as this Youtuber gets ( https://youtu.be/rj_n4W_mDN0?t=340 ). In my case it doesn't automatically provide "NSTextField*LabelInfo", but I can attach the button and label to the script and make them show when I run Visual Studio.
I am not provided this autofill either ( https://youtu.be/rj_n4W_mDN0?t=420 ) or the option of calling the "HelloPressed" function in Visual Studio.
Then I discovered that I have an error message in Xcode when I try to build it: "undefined symbol _main" (which the Youtube person doesn't have).
It also reads:
"Undefined symbols for architecture x86_64:
"_main", referenced from: implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
I deleted my code and restarted the program, but the same message popped up. I deleted both Xcode and Visual Studio, and reinstalled it, but it still came up. This time I didn't add or do anything other than opening a new projects (in Cocoa app), and still I was greeted with this annoyance.
I see that my "Main.cs" in Visual Studio is not appearing in Xcode project (all the other ones are), but I don't know if this is relevant. I have tried to add different Frameworks to Xcode (AppKit), but I still receive this message. Maybe there is something I have to do in the Build section of Visual Studio, but I don't know what.
I have absolutely no clue what to do and how to proceed. I find it so strange and annoying that the Xcode gives me an Error without me doing anything else then starting up the program. My Macbook pro is very new so that cannot be the cause, the softwares are newly updated: Xcode 11.5 and Visual Studio 8.6.5 (build 23). I am programming in C sharp
I hope you are able to advice me in what to do. I am a beginner so I would appreciate easy-to-follow assistance or instructions.
Thank you very much,
August

Sorry I can't offer a definitive answer but hopefully the following will help you find your issue. I don't usually use VS for Mac and installed it just to see if I could figure out your issues. It is not as intuitive as one may like...
Visual Studio for Mac on both Mojave & Catalina does not work appear to work as the video you found seems to show.
Double-clicking on a .storyboard file generally seems to open the file in VS's XML editor rather than in Xcode. There might be a setting to control this somewhere. To open in Xcode right-click (or control-click) the file name and select Open With… -> Xcode Interface Builder in the menu that appears.
– Once over in Xcode you may find you have two open windows, one is just the .storyboard file and the other is a dummy Xcode project containing it. Close the first of these and just edit within the Xcode project window. If you don't do this you cannot create bindings between the controls and the source. If you look at the Xcode windows in the video you found you will see that when the bindings are being made it is in the project window, but there is nothing to show how/why that window opened up at the front.
Do not try to compile the "project" in Xcode. It is not meant to be compiled and appears to just be the bare minimum scaffolding required to enable VS to use Xcode for UI editing. All the errors you got are related to this.
Searching the internet for Visual Studio for Mac and storyboard files turns up plenty of hits and these files failing to open correctly seems a common problem from a scan of the titles. Do some research and you'll probably get it to work smoothly, but it does work as is albeit a little fiddly. HTH

Related

Visual Studio Code Won't auto complete my C# code

SOLVED
Just to clarify this is about VS code not just VS
I've had the worst 3 hours looking for anything that could possibly fix my Visual studio code. I'm using the program to develop a game on unity but I can't seem to get the auto complete thing (I think its Intellisense) to auto complete my code causing spelling mistakes and making coding 10x longer than it needs to take.
Heres a list of things I have tried:
Install .Net Framework v4.7.1 (which is what the console says to do)
Fix the Assembly file made by unity multiple time
Reinstall Visual studio, C# plugin and .Netframework
Change the OmniSharp to the latest version
I will add that when ever I type anything it comes up with "[info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService Could not find document for file c:\Users\Bruhman\Grinder\Assets\Scripts\PlayerMovement.cs"
and when I open visual studios and write anything in the script it'll come up with an error that states "Some Projects have trouble loading. "Source: C# (Extension)" "
Below is a screen shot of what comes up in the console (It's the same every time)
Console
Never Mind I found out the issue, apparently I need to install Visual Studios Community version and then the .Net developer packs from visual studios and not just online, I'm assuming that it doesn't get detected or something when installed through the exe file...
I don't really know much, but I use it every day : have you tried the unity tools extension ?
It features a lot and also the c# auto completion.
If it still bugs, have you installed the .Net for the EXACT version. I also struggled because I had the upper version and not the exact.
Finally is it linked with unity (I don't know if it could interfere if not done)
Sorry I don't know anything else if this don't work.

Unable to run a MonoGame project on a clean installation of Visual Studio and MonoGame

I recently got a new computer, and finally got around to installing MonoGame, as I worked with it a few months back on my old computer, and primarily use Unity for my game development when not working on 2D games. Their website says they have CLI templates that work with Rider, but I figured it would be best to get it installed with Visual Studio first. Following the exact steps listed on the MonoGame website, I got everything installed that I needed, and started a project from one of the Visual Studio MonoGame templates. Upon opening the project, and everything finishing loading, I am greeted to this miserable sight. I also had an error in the console relating to MonoGame, with the error code MSB3073. From what research I did, I found that it either had to do with my username having a space in it (it clearly does not, so that was out of the picture), or it had to do with using the Visual Studio templates, and I would simply need to create the project from the CLI templates, as seen here. However, creating a new project from the CLI templates does not change anything. I have tried uninstalling and reinstalling dotnet, I have tried uninstalling and reinstalling Visual Studio. I have, of course, powered my computer off and back on multiple times. Even trying to open the project in Rider after installing the proper MonoGame packages in the program has the same exact errors. But when I zipped the project up and sent it to a friend who works with MonoGame, he was able to run the project with no issues, so clearly it has something to do with my setup.
I have also cleaned my nuget cache, cleared my project temp folders, and cleared the visual studio cache. Eventually, the Microsoft dependencies stop having issues when I simply close and open the project again, but every time I open the project in Visual Studio, I get the same error in the console, and it prevents me from running/building the project.
Hoping someone on here will know what to do with the info I've given, as I'm completely out of ideas!
So I figured it out. I'm not very experienced with the command line, but I managed to find a very nice tutorial by someone who wanted to make games with MonoGame using only the command line. In it, I was able to attempt to build the project from the CLI, and it gave me an error message unlike what was in Visual Studio. It said that MonoGame only works on a 64bit OS, but I'm on a 64bit OS. So I went to look at what version of dotnet was being used, and sure enough, it was the 32 bit version! It took a while to figure out how to uninstall it, and how to use the dotnet-core-uninstaller tool in the command line. Then all I had to do was remove the Environment Variable in the System category for the Path variable that referenced the Program Files (x86) directory of dotnet.
Hopefully if anybody else comes across this issue, they'll find this post, as none of the others seemed to fully explain how to do anything that needed to be done to fix the problem :)

Visual Studio 2019 Installer doesn't start

I'm using Windows 10 ver. 1909. Installer hangs or does nothing. No feedback.
I had exactly this problem. Same version of Windows 10. I tried both vs_community.exe and vs_professional.exe. On a Microsoft Surface Pro 4. The installer launches, a brief unpacking screen appears, that vanishes, and you're left with the task manager showing the installer but no user interface. I tried numerous different suggestions from Googling as well as the Collect.exe tool. None of that helped. Someone had a similar problem that hinted that a display could cause the problem. My Surface had Duet installed, which allows you to use an iPad as a second monitor. Uninstalling that allowed Visual Studio to install normally. Apparently the Visual Studio installer is finicky about displays so if you have any unusual display drivers, or screen sharing utilities, they should be removed to allow installing. I suspect that the driver or utility could be put back after installation.
In my case, the issue was that I have downloaded and launched the installer to a user folder that contains non-English characters. Moving the installer to another folder fixed the issue. I´ve diagnosed the issue by looking into an installer log file in C:\Users<username>\AppData\Local\Temp\dd_vs_professional__143315035.1628536728_decompression_log.txt.
At first you need to download this tool Event Collect for visual studio, open your CMD as administrator,then run Collect.exe , after that you need to run your visual studio installer in the event of an error you will find and file named C:\Users{username}\AppData\Local\Temp\VSSetupEvents.txt that you can check to see the error messages.
For more details you can check documentation .
My case is very embarrassing for Microsoft. I downloaded Visual Studio Setup and started it right away from browser. It was opened and then immediately closed. Nothing I could read on the Internet about this problem was not helping. Then I did one very simple thing. Moved setup from original location: C:\Users(user name)\Downloads, to c:\Temp -> worked like a charm. The thing is that my user name contains international characters (plus containing a space). All in all 21. century, full unicode support everywhere, but not in windows. Really embarrassing.
Visual Studio 2019 Installer doesn't start
I lost time about something I shouldn't have, I couldn't install vscode studio 2019 (I've installed it on multiple machines before).
I don't know exactly why, observed there might be something in my folder blocking it, I just moved it to a new folder and I could install. Good luck and don't make the same mistake as me

Xamarin.forms with Visual Studio stopped showing error messages

I'm working on my first Xamarin.forms project and Visual Studio seems to be doing everything possible to slow down my progress on this. From the start I've not had any intellisense support for the xamarin.forms or my own objects, but after trying many suggested fixes I've just about learnt to live with this.
However, now Visual Studio has stopped even giving me error messages, something which up until now it was doing. On my computer I've got installs of both VS2015 & VS2017. Some time last week 2017 stopped doing it, so after a bit of failing to find a solution, I went to 2015 and carried on as normal. This morning I've come in to find that 2015 now isn't giving errors either.
If my project is free from compile errors then my project will build and run on my android device as expected, however, if there are any compile errors, then I get the error list tab popping up showing 0 errors and 3 warnings (the warnings always being the same: 1 about version conflicts in dependent assemblies and 2 that file names exceed the 260 character limit within the UWP and iOS versions of the project).
Has anyone else experienced anything like this before? As you can imagine, the combination of limited intellisense and no compile error debugging makes for a pretty horrific dev experience and is seriously undermining the supposed dev time benefits of using Xamarin in the first place.
James
Ok, so after getting pretty desperate for a solution, I tried deleting the .shproj file within my shared project which resulted in visual studio displaying the compile error messages despite it not actually being able to load the project correctly any more. After restoring the .shproj file back, I am now getting error messages and able to build my project.
I don't feel particularly confident that this will be a long term solution to my problem, but for now I am at least able to get on with my work.

VisualStudio cannot run code on MonoGame

I am having issues with running code that is written in VisualStudio 2015 in MonoGame 3.5.
My two versions are compatible, from all I can see. VisualStudio has no issues running Console application codes, and also connects to Unity just fine (I can write code in VisualStudio for Unity and it runs).
I can also open up MonoGame and convert png files into xnb's to use in VisualStudio. It is only when I try to actually run the VisualStudio code and Windows tries to open MonoGame, it fails.
To better show what is happening, I created an empty project specifically by clicking "MonoGame for Windows" in VisualStudio, and called it EmptyGame. By default, running this should yield a cornflower blue screen. Instead, it shows this error message:
error message Ctrl+F5 MonoGame
I then tried to debug the completely default code (it shouldn't have any bugs as it is the default provided by VisualStudio but I did it anyway) and got this:
debugging error message VisualStudio
I have tried googling this error message and not gotten very far. Somebody had a similar error message for Duality2D (https:// forum.adamslair. net/viewtopic.php?f=4&t=732) but the answers they gave don't apply here I don't think...
I have also tried uninstalling and reinstalling both programs, making sure that I ticked VisualStudio 2015 in the MonoGame installation, and turning off my anti-virus while trying to run (Ctrl+F5) - I was desperate at this point.
Anyone got any ideas? I can't possibly be the first person to have issues trying to get VisualStudio and MonoGame to communicate, but Google has gotten me nowhere. I just found this website which had a lot of great reviews so hopefully someone here has an answer for me!
Appreciate it!
-M.

Categories

Resources