Jump to content
  • 0
Sign in to follow this  
iMeleys

solved invalid operands to binary expression

Question

NULL is of type "pointer" bool is either true or false comparing them makes no sense..
how i solve it right now ?

questlua_petnew.cpp:135:12: error: invalid operands to binary expression
      ('nullptr_t' and 'int')
                if (NULL == petActor)
                    ~~~~ ^  ~~~~~~~~
questlua_petnew.cpp:155:12: error: invalid operands to binary expression
      ('nullptr_t' and 'int')
                if (NULL == petActor)
                    ~~~~ ^  ~~~~~~~~
questlua_petnew.cpp:174:12: error: invalid operands to binary expression
      ('nullptr_t' and 'int')
                if (NULL == pet_level)
                    ~~~~ ^  ~~~~~~~~~
questlua_petnew.cpp:194:12: error: invalid operands to binary expression
      ('nullptr_t' and 'int')
                if (NULL == pet_evo)
                    ~~~~ ^  ~~~~~~~
4 errors generated.
gmake: *** [Makefile:96: .obj/questlua_petnew.o] Error 1

questlua_petnew.cpp - https://pastebin.com/PAp4FNtU

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 0

Am Bsp. von pet_evo erklärt.

Dein Compiler sagt ja, er kann nullpointer (NULL) nicht mit int (pet_evo) vergleichen.

Is ja auch richtig.

Als was is pet_evo definiert ?

int pet_evo = petSystem->GetEvolution();

Ah ein int. Was gibt GetEvolution zurück ?

DWORD            GetEvolution() { return m_dwevolution; }

Passt also auch :D

 

Was ist zu tun ?

if (0 == pet_evo)

 

  • Love 3

Share this post


Link to post
  • 0

The Solution is to understand that == is equal and != is not equal !

        if (0 == pet_evo)


 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.