C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-16-2008, 06:53 PM   #1
Registered User
 
Join Date: Oct 2008
Location: CA
Posts: 19
typedef struct from .h and .c

Hello,

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;
Thanks!
Liz

Last edited by Salem; 10-16-2008 at 11:16 PM. Reason: added code tags - learn to use them yourself
tytelizgal is offline   Reply With Quote
Old 10-16-2008, 06:59 PM   #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   Reply With Quote
Old 10-16-2008, 07:35 PM   #3
and the Hat of Guessing
 
tabstop's Avatar
 
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   Reply With Quote
Reply

Tags
c programming, structures, typdef

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 07:57 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22