amaork / libi2c

Linux i2c library, support C/C++/Python
MIT License
174 stars 63 forks source link

Undefined References #10

Open alexisguiter opened 3 years ago

alexisguiter commented 3 years ago

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

GNiramay commented 3 years ago

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

drewfowler17 commented 3 years ago

I am having the same issue. Any help?

drewfowler17 commented 3 years ago

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