NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Implicit Definition Errors

February 05, 2012
by mljohnston
mljohnston's Avatar

I've expanded the directory /libnerdkits/ to include other low level chip functions (for example, I have .c and .h files for "admux", in which the low level work of connecting to the admux register is done). Ditto for SPI and I2C.

In another directory (called "devices" that is parallel to /libnerdkits/ ) I create files for specific chips. So, in the devices directory, i have files for ds1307.c, and ds1307.h.

Since the ds1307 uses the i2c protocol, my file ds1307.c includes "../libnerdkits/i2c.h". Yet,after trying 100 different combinations of header files and include statements, every time I compile the Device files (like ds1307.c) I get Implicit Definition Errors on every reference to a call to a function in i2c.c.

Why does the compiler not see my i2c headers? Why are all the references to i2c in my ds1307.c file ignored?

What's happening? I'm running out of things to try! Thanks in advance....

February 06, 2012
by hevans
(NerdKits Staff)

hevans's Avatar

Hi mljohnston,

Could the issue here be in the Makefiles? There is a Makefile in /libnerdkits that builds the individual files in there that we want built. Then in the Makefile in the individual projects there is a LINKEDOBJECTS line that links the appropriate .o files.

Humberto

February 06, 2012
by mljohnston
mljohnston's Avatar

I figured it out, and maybe this is a good tip for all the other newbies who haven't used the C language before (seems like there are lots of this kind of question on this forum).

It seems that C is sensitive to capital letters. So, in my definition module, I defined "void Test(void)", but in the module using it, I called "test()"... and it tells me that "test()" was never defined. Duh!

February 07, 2012
by Ralphxyz
Ralphxyz's Avatar

That is where posting code comes in.

It is amazing how fast another (or another hundred) set of eyes will spot those types of errors.

Of course if you had started using unix as your operating system as the developers of C did it would only be natural to make it case sensitive.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that interrupts can be used to trigger pieces of code when events happen? Learn more...