![]() |
| | #1 |
| Registered User Join Date: Oct 2008 Location: CA
Posts: 19
| typedef struct from .h and .c Here is my problem: I declare the vector struct in my .h file and then try to access its fields in the .c file. I did declare a variable of type vector. However, I get a compiler error saying that 'vector has no member named' [x] where x is the fields I defined in my struct. Here is my struct def in the .h file: Code: typedef struct {
void* elems;
int elemSize;
int logLength;
int allocLength;
} vector;
Liz Last edited by Salem; 10-16-2008 at 11:16 PM. Reason: added code tags - learn to use them yourself |
| tytelizgal is offline | |
| | #2 |
| Registered User Join Date: Sep 2008 Location: Toronto, Canada
Posts: 507
| I'd have to see your .c code as well. Since so far, you haven't declared much of anything. Just a typedef. |
| nonoob is offline | |
| | #3 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| I like guessing: you are using -> when the left side is not a pointer (in which case you just use .), or vice versa. |
| tabstop is offline | |
![]() |
| Tags |
| c programming, structures, typdef |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Error: redefinition of typedef xxxx | Rocha | C Programming | 2 | 11-24-2008 09:19 AM |
| Looking for constructive criticism | wd_kendrick | C Programming | 16 | 05-28-2008 09:42 AM |
| .h file vs .c file | RocketMan | C Programming | 5 | 05-13-2008 07:28 PM |
| including header files in the program file (.c) or in the header file (.h) | odysseus.lost | C Programming | 4 | 12-14-2005 02:21 PM |
| Difference between .h and .c files | Metalix | C Programming | 9 | 01-19-2005 08:38 PM |