This is a discussion on struct question within the C Programming forums, part of the General Programming Boards category; answered...
Last edited by -EquinoX-; 04-14-2008 at 04:16 PM.
The error message "left side of -> is not a pointer to struct or union" (details may vary) should tell you that the left side of ->, namely rule, is not a pointer to a struct. It is itself a struct; so you need to use rule.target to access members.
if I declare rule_t* rule then this would work right?
Last edited by -EquinoX-; 04-14-2008 at 12:47 AM.
You declare rules to be a pointer to a rule_t. That's fine and good, but at the moment rules points to somewhere just outside of Hoboken, and then when you try to access rules->dependency on the next line, the Mafia comes and gets you.
If you want to actually have a rule, you need to either malloc one for rules to point at, or declare one.
I see.. so the reason why is because I haven't declare rule_t?? how do I declare one?
oh and one more thing, when I put HashTable = HashTableConstuct(50);
it gives me this error:
/tmp/ccGGLIcr.o: In function `main':
memake.c.text+0x52): undefined reference to `HashTableConstruct'
collect2: ld returned 1 exit status
I already include the "hash.h" which is the interface of the hash table.. why wouldn't it work?
what do you mean the source for HashTableConstruct? you mean the .c file??
hmm..doesn't it seem weird to include the .c file?? should including the .h file works?
You don't include the .c file using #include; but you do need to turn that source into executable code!
I don't understand what you mean.. sorry
You have a .c file with code in for HashWhateverItWas(), right? You need to compile that file too. If you have a reasonable IDE, it will handle it for you if you create a "project" (or maybe "solution") and put all the files in it.