jenf

*
Newbie
Posts: 1
Logged
Hello, I just assembled my fitness tracker components.  I was able to run the TinyScreen+ setup tutorial fine.  For the fitness tracker code however, I keep getting these ifstream errors.  Am totally new to C++ and Arduino, so apologies if this error is simple. 

C:\FitnessTracker\FitnessTracker.ino: In function 'int firstQuartile()':
C:\FitnessTracker\FitnessTracker.ino:713:3: error: 'ifstream' was not declared in this scope
   ifstream sdin("quartiles.txt");
   ^~~~~~~~
C:\FitnessTracker\FitnessTracker.ino:713:3: note: suggested alternative: 'Stream'
   ifstream sdin("quartiles.txt");


 A secondary error also seems like it does not recognize "sdin" for the same reason:

C:\FitnessTracker\FitnessTracker.ino:719:10: error: 'sdin' was not declared in this scope
   while (sdin.getline(buffer, line_buffer_size, '\n') || sdin.gcount()) {
          ^~~~
C:\FitnessTracker\FitnessTracker.ino:719:10: note: suggested alternative: 'sin'
   while (sdin.getline(buffer, line_buffer_size, '\n') || sdin.gcount()) {
          ^~~~
          sin
C:\FitnessTracker\FitnessTracker.ino:723:36: error: 'ios_base' has not been declared
       sdin.clear(sdin.rdstate() & ~ios_base::failbit);
                                    ^~~~~~~~


Any advice is welcome, thank you! I have tried adding "#include <fstream>" to the beginning of the file, adding "using namespace std;" after all includes, and using "std::ifstream" rather than just ifstream, as well as combinations of these.  The include creates a long error that calls a max macro in another include file and causes it to exit with the wrong number of arguments. I also tried the suggested "Stream". 

SMF spam blocked by CleanTalk