Zik
Zik

Reputation: 1576

Importance of main() parameters

I'm starting out on SDL using CodeBlocks IDE. I got an error undefined reference to 'SDL_main'. I researched and found out that you need to have the parameters

int argc, char* args[]

in the main(). I added those and the code compiled and worked. My question is, how important are the parameters for the linker to be able to work?

Upvotes: 0

Views: 101

Answers (1)

this
this

Reputation: 5290

Main parameters have to be there because SDL defines main internally as ......SDL_main(int argc, char *argv[])... depending on the system and does some initialization.

Just include main parameters, it doesn't matter if you're not using them.

Upvotes: 2

Related Questions