Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:51:45+00:00 2026-06-13T11:51:45+00:00

I have recently started working with C++ classes and had just started when I

  • 0

I have recently started working with C++ classes and had just started when I reached an error. I have a “resource.h” file that contains the class definition of two classes: ‘deck’ and ‘card’. I #included this file in another file, “card.cpp”. In the card.cpp file I described all the methods/functions of the ‘card’ class. However on compilation I am getting the following the errors (fyi I am using the MinGW compiler for command-line):

card.cpp:3:29: error: ISO C++ forbids declaration of ‘setCard’ with no
type [-fp ermissive] card.cpp:3:1: error: prototype for ‘int
Card::setCard(char, char)’ does not matc h any in class ‘Card’
resource.h:9:8: error: candidate is: void Card::setCard(char, char)

The “card.cpp” file:

#include "resource.h"

Card::setCard(char f, char s) {
    face = f;
    suit = s;
}

Card::Card (char face, char suit) {
    setCard(face, suit);
}

Card::~Card () {}

The “resource.h” file:

typedef unsigned short int UINT;
class Card;
class Deck;

class Card {
    public:
        Card(char face, char suit);
        ~Card();        
        void setCard(char face, char suit);
        char getFace() const { return face; }
        char getSuit() const { return suit; }
    private:
        char face;
        char suit;
};

class Deck {
    public:
        Deck();
        ~Deck();
        Card getCard(UINT x);

    private:
        Card myCards[54];
};

What is causing this issue, and why in the world does the compiler think that “Card::setChard()” is an int

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:51:46+00:00Added an answer on June 13, 2026 at 11:51 am
    Card::setCard(char f, char s) {
        face = f;
        suit = s;
    }
    

    should be

    void Card::setCard(char f, char s) {
        face = f;
        suit = s;
    }
    

    Some hints that helped me get to this amazing conclusion:

    • C++ forbids declaration of ‘setCard’ with no type
    • candidate is: void Card::setCard(char, char)

    If you thought this was cryptic, hold on tight for when you get to templates. Compilers have a history of generating great error messages for them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that I have recently started working on seriously but had
I have recently started working on my master thesis in C that I haven't
I have recently just started working with Lucene (specifically, Lucene.Net) and have successfully created
I have recently started working on a very large C++ project that, after completing
I have recently started working with Drupal on the side and have had to
I have recently started working with Android. I don't have that much experience with
I have recently started working on a legacy application that has most of its
This is a very elementary I realize, I have recently started working with asp.net
I have recently started to learn Objective-C and write my tests using OCUnit that
i have recently started working on C# and i am very amateur at it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.