Problem compiling with 1.5 or higher.. (I refer to another unsolved post)

Hi,

I just went back to a project I did last year where I use an Arduino Uno to get data from an array of IR sensors and send those values via OSC to processing software (just to situate..). Anyway, since last year I updated from 1.0.5 to 1.5.8 and 1.6.5 lately to play around with some experiments with no problem.

However, when compiling the old project I get similar errors to those posted here:

http://forum.arduino.cc/index.php?topic=285402.0

It is also when using the ArdOSC library and I completed the project with no issues in the past. In fact, I installed 1.0.5 version and runs perfectly.

Why is that? I installed libraries properly and tried myself solutions given in the aforementioned post and some others like reinstalling, libraries, software and so on..

Any ideas or something I am missing?

I have to admit that I can t usually dedicate much time to Arduino programming and only use it to get values from sensors to computer..

Many thanks in advance

https://github.com/recotana/ArdOSC/issues/6#issuecomment-126849394

Thanks pYro_65, I will try that later.. I kind of guessed I could do something like that but my question was more to understand why some libraries might work with earlier versions and not with new ones..

However, this is like a patchy solution to this particular case and will be likely to happen in the future with other libraries and would be interesting and time saving to know what is causing the problem and specially if I am doing something wrong.

Thanks again

Its not really patchy at all, and you are doing nothing wrong, the code as it stands is faulty. The later IDE's contain a newer compiler which is far stricter (and correct). If it worked previously, you are just simply lucky.

For example: OSCEncoder::OSCEncoder encoder;

This is not creating a type of OSCEncoder, it is looking inside OSCEncoder for a type named OSCEncoder which is the constructor, not a type. If I get time, I can investigate why it was working, but the fix is simply what was recommended in the GitHub comment.

mmm ok.. Thanks a lot for the explanation so library is bad coded.. Also, thanks for the effort and no need to dedicate time to find out why it is working in older IDEs (unless you want to of course).

For me, it is more than enough to know that is a library coding error, which makes sense by the way, and not user error from my side.. It could by as you say an stricter IDE, anyway I will post later when I test it.

OK… I am back… After a while of trying the solution from comment in Github, I have to say that is not as straight forward as it sounds… at least for someone like me with his own rusty little c++ knowledge…

I somehow cleared up all errors in headers files (not sure if did ok) by removing class specifications (the OSCxxx:: part) from type declarations but now I get another error in a cpp file, there are actually 6 errors but I guess is the first what messes up everything… Here are the error messages:


Arduino:1.6.5 (Mac OS X), Placa:“Arduino/Genuino Uno”
/Users/Juanpi17/Documents/Arduino/libraries/ArdOSC-master/OSCEncoder.cpp:23:41: error: ‘int16_t OSCEncoder::encode’ is not a static member of ‘class OSCEncoder’
int16_t OSCEncoder::encode( OSCMessage::OSCMessage *_newMes ,uint8_t *_binData ){

  • ^*
    /Users/Juanpi17/Documents/Arduino/libraries/ArdOSC-master/OSCEncoder.cpp:23:53: error: ‘_newMes’ was not declared in this scope
    int16_t OSCEncoder::encode( OSCMessage::OSCMessage *_newMes ,uint8_t *_binData ){
  • ^*
    /Users/Juanpi17/Documents/Arduino/libraries/ArdOSC-master/OSCEncoder.cpp:23:70: error: expected primary-expression before ‘*’ token
    int16_t OSCEncoder::encode( OSCMessage::OSCMessage *_newMes ,uint8_t *_binData ){
  • ^*
    /Users/Juanpi17/Documents/Arduino/libraries/ArdOSC-master/OSCEncoder.cpp:23:71: error: ‘_binData’ was not declared in this scope
    int16_t OSCEncoder::encode( OSCMessage::OSCMessage *_newMes ,uint8_t *_binData ){
  • ^*
    /Users/Juanpi17/Documents/Arduino/libraries/ArdOSC-master/OSCEncoder.cpp:23:80: error: expression list treated as compound expression in initializer [-fpermissive]
    int16_t OSCEncoder::encode( OSCMessage::OSCMessage *_newMes ,uint8_t *_binData ){
  • ^*
    /Users/Juanpi17/Documents/Arduino/libraries/ArdOSC-master/OSCEncoder.cpp:23:81: error: expected ‘,’ or ‘;’ before ‘{’ token
    int16_t OSCEncoder::encode( OSCMessage::OSCMessage *_newMes ,uint8_t *_binData ){
  • ^*
    Error de compilación
  • This report would have more information with*
  • “Show verbose output during compilation”*
  • activala desde Archivo > Preferencias*

^
I tried to modify a few things there like removing OSCEncoder:: or OSCMessage:: with no luck, just giving more errors and getting lost…

Anyway, this is just for the sake of it, I managed to compile and load my old code to Arduino with the 1.0.5 IDE version and the original version of the ardOSC library (apart from the fact that having to change the folder name to avoid the “-” character) and works as expected.

In fact, using the modified library in the older version of IDE gives new errors (but this is 95% chance that is due to my bad fixing of the library). Basically errors are: “OSCClient does not name a type”, “OSCMessage does not name a type” things not declared derived from this errors…

Thanks again in advance

I have cloned the library, fixed it and corrected spellings.

Tonight the Arduino team will add it to the library manager. Keep an eye on the issue linked below, when closed wait an hour and it should appear in the library manager (IDE 1.6.2 and above). https://github.com/arduino/Arduino/issues/3835

Or you can download the library here (library manager is easiest though): Clone: https://github.com/Chris--A/ArdOSC

Your code may need updating if you used any of the incorrectly spelled functions. However the examples compiled fine.

There were some warnings (more bad code), so let me know if there is a problem (compiles, but runs incorrect) and I'll have a look.

Hey, Thanks for that! I installed the library and compiles and run perfectly (so far..). I did not have time to test it in depth as I am a little busy with other works but looks like it s running as it used to.

In fact, I want to update, review and tide my code, I am sure that can be a little bit more efficient, I just did a quick "collage" from 3 or 4 different codes without spending much time on it due to time schedule when that project happened.

Anyway, that s another story but I will inform you if I see something strange (which again, most probably will be bad practice from my side anyway), so far so good, not even warnings.. looks like a good fix.

Thanks for your help!

You'll have to turn on verbose/all warnings in the preferences. But its good to know they aren't affecting things so far.