SDL project FAQ (error lnk2019: external symbol _ main that cannot be parsed, which is referenced in function _ maincrtstartup)

Source: Internet
Author: User

This question has been asked by many netizens on the internet, who have given various answers. Here, I also encountered this problem in the SDL multi-media library. After a while of exploration, I finally found the answer.

Under normal circumstances, after compiling the SDL header file and library, you only need to direct the header file and library file path to the correct location. Then, you can directly use the header file and library.

Generally, the static libraries used are SDL. lib and sdlmain. Lib, the dynamic library is SDL. dll, And the header file is SDL. h.

If you use the following in a project:

# Include <SDL. h>

# Pragma comment (Lib, "SDL. lib ")

 

Int main ()

{

...

}

The above Link error will occur. The reason is that the library sdlmain. Lib is missing. That is, the following solution is used, which is correct.

# Include <SDL. h>

# Pragma comment (Lib, "SDL. lib ")

# Pragma comment (Lib, "sdlmain. lib ")

 

Int main ()

{

...

}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.