-1

I'm trying to get my program to allow me to use C++'s input and output streams for debugging purposes but it won't work?

My code:

#include <SDL.h>
#include <iostream>

using namespace std;


int main()
{
    cout << "I work!";

    return 0;
}

That is all I have and it won't work. I plan to use SDL to make a small checkers game but I'd like to use <iostream> to debug.

Here's my errors:

error LNK2019: unresolved external symbol _SDL_main referenced in function _main_utf8

fatal error LNK1120: 1 unresolved externals
Praetorian
  • 106,671
  • 19
  • 240
  • 328

1 Answers1

1

This is covered by FAQ:

Make sure that you are declaring main() as:

int main(int argc, char *argv[])

Since SDL_main is not special name known to C++ compiler, it mangles it by general rules. SDL have forward declaration with correct linking flags (at least extern "C") only for int SDL_main(int, char**).

keltar
  • 17,711
  • 2
  • 37
  • 42