![]() |
GCC Error: ‘foo’ has no member named ‘bar’
3 Attachment(s)
I'm doing a programming exercise from the book "Programming Challenges" where I'm trying to write a program that simulates the card game "War".
I'm getting the following errors when I try to compile my code: Code:
cards.c: In function ‘shuffle’:Code:
typedef struct Card {Code:
gcc -Wall -std=c99 war.c cards.c -o warI've attached the full source files to this post, but it would only let me attach 3 of 4, so I posted the last header (war.h) to the bottom. Thanks, jrtayloriv --------- Code:
//war.h |
Bah -- been looking at this for 30 minutes and, naturally, right after I posted, I figured it out. I didn't realize that I couldn't set initial values within the struct definition.
i.e., just for anyone else who finds this through Google, you can't do: Code:
struct foo {Code:
struct foo { |
Quote:
|
| All times are GMT -5. The time now is 02:48 AM. |