Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Jan 2012
    Posts
    2

    Error: C2512: 'Game' : no appropriate default constructor available - Evil Monkey

    I'm getting an error saying: "Error: C2512: 'Game' : no appropriate default constructor available" while doing the tutorials of Evil Monkey game in C++.
    I've researched it and I can't figure out what the problem is. Can someone help me out?

  2. #2
    Join Date
    Sep 2005
    Posts
    158
    Check through your code, sounds like your trying to call a constructor that does not exist.

    something like myGame = new Game(char blah); <- if there is no constructor that has this, then it will fail.

    Hard to tell without some kind of code, so if the compiler give you a line, you should probably post it here.

  3. #3
    Join Date
    Jul 2006
    Location
    San Diego, CA, USA
    Posts
    897
    Game's default constructor is being called but there isn't one defined. The default constructor is the one without any parameters. The compiler will implicitly create one for you if you haven't created one yourself and/or you haven't defined one or more that has parameters. Once you create any with parameters then you don't get the default one (parameter-less) automatically anymore. You have to make that one yourself at that point.

    Now you may not want to use a parameter-less constructor which brings us to that fact that there may be more to this. Can you show some code where you create the Game object?
    Code Fearlessly!

  4. #4
    Join Date
    Jan 2012
    Posts
    2
    I've got it to work, the only thing I had to do is to create a default constructor for the drawEngine class.
    Thanks a lot for your help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •