Trying to initialize four structs but it says undefined. The program is in c and using gcc as compiler.
Code below:
struct Deck_init{
int card1, card2;
};
// Initialize player decks
//Deck_init player1_hand, player2_hand, player3_hand, player4_hand; // Need this to work
//Deck_init player1_hand {0,0}; // Test line
//Deck_init player1_hand; // Test line
Error:
identifier "Deck_init" is undefined
If needed, here's the code up to that point:
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#define NUM_THREADS 4 // Number of players
#define NUM_CARDS_IN_DECK 52 // Cards in deck
#define PTHREADM PTHREAD_MUTEX_INITIALIZER
#define PTHREADC PTHREAD_COND_INITIALIZER
struct Deck_init{
int card1, card2;
};
// Initialize player decks
Deck_init player1_hand, player2_hand, player3_hand, player4_hand; // Need this to work
//Deck_init player1_hand {0,0}; // Test line
//Deck_init player1_hand; // Test line
What I've done:
- Tried initializing one object
- Tried singaling the problem into it's own seperate file and still problems.
struct Deck_initortypedefthestructpart away.