C++ Function Syntax " main code error " Need Help

Hello,

*Problem:
So I am just writing the simple code:
int main()
{
return 0;
}

*Expected:
win32 screen show up with " press any key to continue " line.

*What I receive:
An error as attached, I think there is something wrongly setup with my program.

Will you please help me ?

Thank you.

From the screen capture, it appears that your program did not compile.

This would be the case if it did not build for some reason.

Just do a Build > Build Solution (with Visual Studio) and see what messages appear. They should be in a panel at the bottom of the screen that shows a Build result or there will be an Error panel specifying problems that were encountered in your code.

From the obscured message in your screen shot, it appears that the libraries are not installed properly. Run the installer for Visual Studio 2015 Community again and select Modify. Then ensure that the VC++ option is selected completely. This is shown in the lecture and also in an example on configuring VS 2015 Community.

1 Like

Hello,

Thank you so much for that, that actually lead to fixing my issue, I just went back to the setup and ticked what I will show in the attached picture.

Thank you so much, now I can continue learning.

I kept getting the same error. I was not able to run the function and return zero until I saved all.
I noticed in the video that Ben did not have to save to compile run his changes.

I am not following, so you have the problem still persists ? if you do, will you please share the attached code and error you have ?

That’s because @ben has this “Do not show this dialog again” ticked so it will automatically save and build before debugging.

2 Likes

Hi. So I’m having the same problem. Entering the code,

int main()
{
return 0;
}

I’m getting the following error message:

I’ve tried reinstalling the required libraries and it seems like I have the same ones that are required.

But for some reason it’s still not working. Any help would be appreciated.
Thanks!

Pretty sure you created a “Win32 project” instead of a “Win32 Console Application”

1 Like

Thanks so much. I didn’t think I did that, but now it works without a problem. Must not have been paying attention the first time. Cheers!

Privacy & Terms