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

  • SEARCH
  • Home
  • 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 6319623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:50:15+00:00 2026-05-24T15:50:15+00:00

Okay, I’ve tried using Google-sensei and searching around on this website, and while I’ve

  • 0

Okay, I’ve tried using Google-sensei and searching around on this website, and while I’ve found many posts about this error, I haven’t found any that have addressed enums. Also, all the ones I have seen have either been someone trying to assign one type to another, improper use of ‘new’, etc. As far as I can tell, that’s not the case in this instance.

As stated in the title, I’m getting an error conversion from 'KanjiCard*' to non-scalar type 'KanjiCard' requested when trying to compile the program I’m working on using g++.

I have a class named KanjiCard that has this publicly-defined enum:

enum KanjiCardType {
    KANJI_CARD = 1,
    KEYWORD_CARD = 2
};

The constructor for the class is defined as follows:

    KanjiCard(char *cardText, int cardTextLength, int cardWidth, int cardHeight,
        int cardX, int cardY, KanjiCardType cardType, SDL_Color textColor);

(I’m using char* instead of std::string because it’s easier to work with the libraries I’m using that way.)

I’m calling it to create new cards like so (this is where the error comes up):

KanjiCard currentCard = new KanjiCard(kanji_line, strlen(kanji_line), 
    CARD_WIDTH, CARD_HEIGHT, xPos, yPos, cardType, textColor);

cardType is defined as such: KanjiCard::KanjiCardType cardType = KanjiCard::KANJI_CARD;

I originally tried just passing in KanjiCard::KANJI_CARD where cardType is in that constructor call right now, but I got that error, so I’ve been trying everything I could think of to try and get it to work, including trying switching the cardType parameter in the constructor to *cardType and &cardType and messing around with the type of cardType in the call as well, to no avail.

As far as I can tell, cardType isn’t a pointer, so I really can’t figure out why I’m getting that message. Any help would be greatly appreciated, as I’m at my wit’s end trying to figure this out.

Edit: I should also mention that I also tried pulling the enum out of the class (and removing the KanjiCard:: preface, of course), and still had the same issue.

  • 1 1 Answer
  • 1 View
  • 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-05-24T15:50:16+00:00Added an answer on May 24, 2026 at 3:50 pm

    It’s not cardType that’s the problem; it’s currentCard. You wrote this:

    KanjiCard currentCard = new KanjiCard(...
    

    That’s assigning a pointer to a non-pointer type. You may have meant this:

    KanjiCard *currentCard = new KanjiCard(...
    

    …or you may have meant this:

    KanjiCard currentCard(...
    

    The former of my suggestions will allocate a KanjiCard on the heap. currentCard will point to the KanjiCard. The latter will allocate it on the stack. It is a KanjiCard.

    The former you’ll have to manually delete. The latter doesn’t need to be deleted; it is valid within the scope it’s declared and once it goes out of scope, it’s invalid.

    The former you can access members of using ->. The latter you can access members of using ..

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

Sidebar

Related Questions

Okay this question is very simple: I have a facebook page, and a website.
Okay, I'm trying to reverse engineer a feature on a website I found -
Okay. I know this looks like the typical Why didn't he just Google it
Okay so I can't figure this out. Like a file that I using grep
Okay, I'm reading about Linux kernel development and there are some code snippets using
Okay, I feel a bit foolish for having to ask this but I guess
Okay, this is probably a very basic question; but, I'm just getting back in
Okay, so I'm not even sure how to ask this question (much less search
Okay,I've been following this tutorial http://coenraets.org/blog/android-samples/androidtutorial/ Basically it gives me exactly what i need
Okay, I'm a little fuzzy on how this works or if it's possible. I

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.