answered
answered
Last edited by -EquinoX-; 04-14-2008 at 03: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?
edited
Last edited by -EquinoX-; 04-13-2008 at 11:47 PM.
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?
Note the "ld returned" which means we're dealing with the linker. It compiled just fine -- but you need to include the library itself. Do you have the source for HashTableConstruct? If so, add it to the project. Do you only have the binaries (in .o, .obj, .lib, .dll, .a, or .so form)? If so, you'll need to link it in using the -l switch (on gcc, I forget what it is on MSVC).
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.