Jump to content
  • Advertisement
Sign in to follow this  
TurnX

Issue with missing Main() function

This topic is 3759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

alright I am going to try and explain what I am trying to do well enough o avoid posting my code, since its all separated into several header/source files. So basically here it is: I am following along with a book thats going through some basic windows coding, enough to get direct3d started and running, and then through direct3d. The last program I did was a basic program, it loaded a background and spaceship sprite and allowed me to move the spaceship around with the arrow keys. The sprite was defined as a struct and I thought "hey wouldn't it be cool to turn it into an object so I can expand on my C++ knowledge." I mainly wanted to do this for fun and to get to know the direct3d functions and such a little better. So I made a new header/source file and turned all the struct variables into a Spaceship class with simple functions for setting and retrieving the variables. After going through the various errors I finally fixed them all except for one fatal error: error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup I looked it up and it pretty much means there is no Main() function, which would make sense since C++ needs a Main. Now I would have to assume, seeing that people code with C++ and Direct3D all the time, that there has to be a way around this. So my questions is how do I fix it?

Share this post


Link to post
Share on other sites
Advertisement
Is there a WinMain() function in your program? If so then you want a windows application instead of a console application. That looks like an MSVC linker error code so you probably need to change the linker subsystem from console to windows.

Share this post


Link to post
Share on other sites
It's complaining about a missing CRT main. Is your main a WinMain one?

You'll need to change the project type to a Windows application if so. There is a way to change them without creating a new project, but it escapes me.

EDIT: Beaten to it

Share this post


Link to post
Share on other sites
thank you very much, as soon as I switched the linker system to windows all worked well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!