Which header and code files are used?

Status
Not open for further replies.
Hello
I have been struggling with using an SD card with a Teensy 3.2. Some of the example code works and my sometime my code works. I have had many years of coding in C, C++, C# and Java but am quite new to the Arduino environment. I am running under Linux.
I think I could sort out my own problems if I could discover which header and cpp files are actually being used in the build process. For Example, if I do

#include <SdFat.h>

then create a file in global space (before setup())

SdFat sd;
// Log file.
SdFile fileSD;
uint8_t bLogging = true;
uint8_t bFileOpen = false;

in setup()

if (!sd.begin(csSD, SPI_QUARTER_SPEED)) {
Serial.println("sd.begin failed");
}
else {
Serial.println("sd.begin ok at 1/4 speed");
}


and then in my code
....
// open the file for write
if (bFileOpen) fileSD.close();
while(fileSD.isOpen()) ;
bFileOpen = fileSD.open(filename.c_str(), O_WRITE | O_CREAT | O_AT_END);
if (verbosity > 0) {
cout << "Open File " << filename.c_str() << " ";
if (bFileOpen)
cout << "OK" << endl;
else
cout << "Failed" << endl;
}
...

It sometimes opens the file and will write to it and sometimes fails. I would like to examine the source code for SdFile::eek:pen() (and close and isOpen) but I cannot discover which library files are being used. In fact I cannot find (Grep'ing around) any SdFile:eek:pen() that only takes two parameters. But this works a half of the time. The code in the example dataLogger, which makes a similar call, works properly.

I would really like to find the library code that is being used in the build. Is there any thing in the IDE which will allow me to discover which SdFat.h is used and which .cpp it is connected to?

Dave Heffler
 
I recommend if you come from a strong programming background not to get involved in Arduino as these sort of issues arise often and require a backwards kind of thinking to resolve. Then again it depends what you're trying to do and why you're doing it. This is just one man's opinion

I mainly just use the Arduino libraries for quick prototyping on these ARM cores. Paul's really saved me a lot of time, which in my line of work I don't have

SdFat.h is under C:\Program Files (x86)\Arduino\libraries\SD\src for me on windows
 
If you turn on Verbose output in the Arduino settings during compilation time, you can see exactly where it is getting the files from.
 
Status
Not open for further replies.
Back
Top