Forcing IDE/AVRDude to re-compile libraries after changes have been made

Hi,

I'm trying to make some changes to a library but none of the changes I make have any effect.

I've edited (and deliberately broken a function I use) the file UIPClient.cpp from within the UIPEthernet library (~/Documents/Arduino/libraries/UIPEthernet/UIPClient.cpp) but my sketch still compiles fine.

Before trying this I had made some changes to timeouts, but these had no affect, which was what lead me to trying to see if my changes did anything at all. They appear not to make it into what's sent to the board.

I think it's because the library is already compiled and the IDE is just using the existing cache.

I'm on a Mac by the way, which I'm not as proficient with in terms of the file system (vs Windows), which isn't helping!

Things I've tried...

  • Looked for .o files to delete in the library, but can't see any.
  • Deleted temp files in /var/folders/67/ which was where AVR Dude said the files were when I enabled verbose logging
  • Switching boards between one and another

I'm sure I'm missing something silly, but I'm a bit stuck!

Thanks,
Sam

Also I have since tried...

  • Removing the library folder - the sketch then won't compile, so I know I'm at least working in the right folder.

  • Renaming the file in question, but the sketch compiles fine.

The sketch includes UIPClient.h, but I'm editing UIPClient.cpp. I assume this is normal, there isn't any functional code in the .h

Have you turned verbose mode on? Perhaps a clue will present itself.

Hi, thanks for your reply.

Yes I have and I've deleted the temp files as far as I can tell - it seems they get put here (this is the file name I have edited too):

/var/folders/67/tk_62j613zndcfwxl3t04sb00000gn/T/build455435735465891803.tmp/UIPEthernet/UIPClient.cpp.o

When I next compile, I get the error 'Build folder disappeared or could not be written' (so I'm pretty sure I deleted the right one).

Now if I close the IDE and open it again, then compile it works, but I don't think it should work... I messed with the code. There's no way that should compile.

unsigned long starttime = millis();
if (conn)
{ ERRORS ERRORS ERRORS ;{errors}
while((conn->tcpstateflags & UIP_TS_MASK) != UIP_CLOSED and 1==2)
{;

It's still using whatever it's got from before :~

Sam2D:
Also I have since tried...

  • Removing the library folder - the sketch then won't compile, so I know I'm at least working in the right folder.

  • Renaming the file in question, but the sketch compiles fine.

The sketch includes UIPClient.h, but I'm editing UIPClient.cpp. I assume this is normal, there isn't any functional code in the .h

If you are in windows, check the %temp% (yes, that's "percent-temp-percent") directory.

I added a "Clean before compile" option to my IDE just for that purpose. However, I run Linux so I delete the IDE work files in "/tmp".

You don't delete the whole directory... you only delete the *.o and *.d files.

I think it would probably be easier on Windows, unfortunately I'm working on a Mac for this.

Surely there's something simple I am missing? It can't be this hard, developing a library would be a nightmare otherwise, you'd only get to test it once.

Sam2D:
I think it would probably be easier on Windows, unfortunately I'm working on a Mac for this.

Surely there's something simple I am missing? It can't be this hard, developing a library would be a nightmare otherwise, you'd only get to test it once.

In MacOS, I would think the files are in "/tmp" since MacOS is actually BSD Linux.... (Leopard 10.5 and above)

If you find the files, try this command line in the "build.........." folder of the project you are trying to compile.

WARNING THE FOLLOWING COMMAND DELETES FILES - TEST IT IN A TEMPORARY DIRECTORY FIRST!

find -name '*.[d|o]' -exec rm {} ;

Not sure if the syntax is exactly right for BSD.... but the idea is "find all files ending in .o or .d in this directory and all below and delete them".

Thanks for the tip, I'll try this soon, the only thing is I have already deleted all the temp files and it's still using a cached/compiled version of the library without my changes... so not sure this would really help.

Also, again surely I am missing something silly here. There must be a way to just tell the IDE 'recompile everything' or recompile the library I've just edited.

Have you tried selecting a different board (say a Mega if you are programming for an Uno) and clicking verify. Don't worry if there are errors. Then change the board back to Uno.

The IDE seems to do a full when the board is changed - maybe it will solve your problem.

...R

Works perfectly on Windows, Mac OSX is doing something weird with files... guess Apple knows better than what I tell it to do :roll_eyes: