-
-
Notifications
You must be signed in to change notification settings - Fork 7k
The SPI library and the ArduinoRobot library will not compile when both included #1709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
To Michael; To Arduino team : this is not the 1st time I see someone with such problem. Thanks 2013/12/1 Michael1516 [email protected]
|
Thanks! And I agree, the compiler should not act like this. |
Could you elaborate a bit on how it's broken exactly? Pasting compiler output and errors would be helpful. I just quickly tried this on my 1.0.5 and got an error:
However, I'm not sure that this is the same error you are referring to? |
Hi, I was testing an example from Adafruit and I got: In file included from /usr/share/arduino/libraries/Robot_Control/SquawkSD.h:4:0, Does this help? |
This is probably the same issue as I reported on 4 november on the developers list. |
@jantje, I'm not sure what mail you are referring to exactly? Neither of your posts to that thread seem related to me? Furthermore, it seems that the KEY was not declared error is not the same error the original reporter was referring to. He talks about multiple definitions for all SPI identifiers. Looking more closely, I see that the KEY macro is defined in the pins_arduino.h file for the Robot_control board. In other word, we get it because we didn't select the Robot_Control board. If I change to the Robot_control board, I get the SPI errors the poster mentioned:
Out of time for now, I'll try to have a look tomorrow. |
The problem I refer to is in regards to the remark Arduino finds libraries based on .h names. It also prefers user installed libraries to arduino delivered libraries. |
@jantje, I see, thanks! It looks like the Arduino_Control library indeed contains a verbatim copy of the SPI library (SPI.cpp and SPI.h are identical to the ones in the SPI library). I presume this is so you can add the Arduino_Control library and things will work, without requiring the user to include SPI.h in their sketch as well (@cmaglie, you added these files, am I correct)? However, the side effect of this is that when you do include SPI.h, the IDE will link against the real SPI library as well, causing these conflicts. Removing the SPI.cpp and SPI.h files from the Arduino_Control library is the proper way to fix this. However, as a side effect, we'll break every sketch that uses Arduino_Control, because those no longer link against the SPI code. The proper fix for this again is to make the IDE aware of inter-library dependencies, either by autodecting (#236 / #1250) or by allowing a library to explicitely specify it's dependencies in a library.properties file or something. Until either of these is implemented, I don't think we can fix this particular issue. As suggested before, if you need to make things compile right now, you can remove the either the SPI library, or I think also the SPI.cpp and SPI.h files from the Arduino_Control library as a workaround. |
Note that, as reported in #1599, all of this also applies to the Wire lib (which is also included in Robot_Control). |
Hi guys, and thanks for the analisys. I don't know why a verbatim copy of SPI and Wire are "bundled" in the Robot_Control library. When I looked at #1599 I thought that the Wire copy was an "optimized" version specific for the Robot, but now I realized that is exactly the same as the standard Wire library, so to me it doesn't make sense anymore to have it just copied there. @dcuartielles and @X-Y, since you authored the library, may you explain why? I'm for removing the SPI and Wire copy (and any other eventual exact copy of sub-libraries included in the Arduino_Robot). About the other issues, I'm going to give a look to the recursive "include" problem.
C |
Hey guys! |
…posite, updated turning algorithm
Fixed in 1.5.6 |
* 'master' of https://github.com/arduino/Arduino: Corrected repeated 'less' in checkName's message Removed unused code, fixed indentation. Local (user installed) libraries have priority over system libraries Update README.md Added license for Client, IPAddressm and Server (master branch) Added license for Arduino.h, binary.h and main.cpp (master branch) Added some friendly messages for Arduino Robot include errors on old sketches Revert "Changed pins definition in variants from constants to #defines." Fixed issue arduino#1478, arduino#1599, arduino#1709, motors being opposite, updated turning algorithm If 2 libs have same .h file, use the lib with same dir name WiFi Shield examples: added the firmware version check Updated Listfiles SD example Rename README.mkdn to README.md Update and rename readme.txt to README.mkdn Update readme.txt Minor changes to Communication Examples
The compiler (arduino 1.0.5) gives a multiple definition error for all SPI commands when code, including this, is compiled:
Please fix that ASAP, I can't use an SPI interface with the robot!
The text was updated successfully, but these errors were encountered: