jeudi 5 mai 2022

Error Missing Type specifer - int assumed . Note C++ does not support default init

In order to make two objects, Player1 and Player2, of a class Player sending and receiving messages, I implemented a blocking queue to synchronize the messages. This is the code I used:

#include <iostream>


using namespace std;

class Msg
{
public:
    Player* sender;
 };

template <typename T>
class BlockingQueue
{
public:
    void push(const T& val)
    {}

    T pop()
    {}

};

class Player
{
    BlockingQueue<Message > queue;

public:
    
    void sendMessage()
    {
    };

    void run()
    { //...... 
    }

    


};

In the Player class, I get an error indicating that Player* sender is not a member of the Message class!

And in the Message class, i get this error:

Severity    Code    Description Project File    Line    Suppression State

    Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int

Can you please help me with this?

Aucun commentaire:

Enregistrer un commentaire