libi2c icon indicating copy to clipboard operation
libi2c copied to clipboard

Undefined References

Open alexisguiter opened this issue 4 years ago • 3 comments

Hi,

I am trying to compile C++ code based on the example code "i2c_without_internal_address.c"

However I keep getting erros when compiling such as:

undefined reference to `i2c_open'
undefined reference to `i2c_ioctl_write'
undefined reference to `i2c_close'

Is ther a proper way to compile perhaps? I'm using g++ my_code.cpp -o output

alexisguiter avatar Jun 02 '21 08:06 alexisguiter

I have the same issue. Did anyone find a solution?

GNiramay avatar Sep 01 '21 00:09 GNiramay

I am having the same issue. Any help?

drewfowler17 avatar Sep 14 '21 17:09 drewfowler17

You need to compile it all together. I wasn't compiling the library, just the single file. i.e. If you had them all in the same folder (unlike how it is in the repo) your command would be: gcc i2c.c my_code.c -o output. @alexisguiter @GNiramay

drewfowler17 avatar Sep 14 '21 20:09 drewfowler17