question

Sophie-1667 avatar image
0 Votes"
Sophie-1667 asked Sophie-1667 commented

#include<iostream> returns error LNK2019, what manipulation should I perform?

90411-picture1.png


c++
picture1.png (2.3 MiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JeanineZhang-MSFT avatar image
0 Votes"
JeanineZhang-MSFT answered Sophie-1667 commented

Hi

As far as I'm concerned, the reason for this error is that the entry point is not defined.

The application code must define an appropriate entry point: main or wmain for console applications, and WinMain or wWinMain for Windows applications.

For more details, I suggest you could refer to the Doc:
Linker Tools Error LNK2019
An entry point isn't defined

All C++ programs must have a main function. If you try to compile a C++ program without a main function, the compiler raises an error.

Best Regards,

Jeanine



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This really helps!! Thanks!

0 Votes 0 ·
RLWA32-6355 avatar image
1 Vote"
RLWA32-6355 answered

First of all, the errors being reported are linker errors, not compilation errors. They have nothing to do with the iostream header.

Your first step should always be to look up the explanation of the error message in Microsoft's documentation. Did you do this?

The error about unresolved external references in the image posted above usually results from a mismatch between code being compiled (console application uses main (or wmain) entry point while windows desktop application typically uses WinMain (or wWinMain) and the subsystem value used by the linker in the project properties.

If you want to create a console application I suggest you start over and make sure to pick a console application project from the New projects templates.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.