Hello I'm new to this website. I love video games, and I hate working in warehouses. I want to learn how to program so I bought a book called Sams Teach yourself c++. I'm at the part where it tells me to download windows visual studio. It tells me to create a win32 console application and name the project.
Then it says to uncheck the Precompiled Header option, and I did. Then it says replace the automatically generated content, and replace with the code:
After that it says press ctrl+f5 to run the program directly via the IDE. This compiles, links, and executes your application. But I'm getting errors. I have double checked multiple times and it is typed correctly. Can anyone tell me whats wrong with my setup. I highly doubt a well published book would tell me incorrect code. What is wrong with my setup? The error says:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) WindowsProject2 c:\Users\PC\source\repos\WindowsProject2\WindowsProject2\MSVCRTD.lib(exe_winmain.obj)
before you say you need the closing bracket, i did, but im used to the program putting it in for me so i naturally forgot to put it in here, i did use a closing bracket
Ok - I read your post and explanation. But I used the cpp.sh link Next to your code in the post above, to the top-right is a button with a gear icon , labelled 'Edit & Run'. Click there, it takes you to an online compiler with your code, where you can compile and run it.
MSVS names things naturally, but for a beginner it can be confusing.
Anything you compile on Windows is a Win32 application (unless you are knowingly cross-compiling for, say, Android or something).
There is, however, a significant difference between a console application and a GUI application. MSVS also creates sub-catagories of those depending on what libraries you intend to use.
For your purposes, you only need start with a straight-up, empty, non-anything else, C++ console application (for Win32).