AnsweredAssumed Answered

C++  bug:  <fstream> not including correctly

Question asked by Marc Lindahl on Jul 24, 2013
Latest reply on Jan 3, 2014 by Marc Lindahl

I'm getting a very odd error in C++, CW 10.4, Kinetis project.  I can't compile an std::ifstream variable!


Taking the Freedom_CPP project from ErichStyger/mcuoneclipse · GitHub

And modifying it, I add an ifstream variable to the class, and #include <fstream> to the top of the file and get this error.

Searching all day for an answer and can't figure out why this doesn't work.



Here's the modified application.cpp source file, everything else the same:



* main implementation: use this 'C++' sample to create your own application




/*#include <stdio.h>*/ /* uncomment to enable 'puts' below */


#include "application.h"


#include <fstream>


class counterclass



  int m_counter;




  m_counter = 0;


  void increment(void)




  std::ifstream file_;



void APP_Run(void)


  counterclass myccounter;


  /* Enabling 'puts' below will use the UART/SCI of your target.

  * Make sure you correctly set it up or how to use the Debug Console instead.

  * See the targeting manual for details.


  /*puts("Hello (Kinetis) World in 'C++' from MKL25Z128 derivative!");*/


  for(;;) {





And the console output:


'Building file: ../Sources/application.cpp'

'Executing target #3 ../Sources/application.cpp'

'Invoking: ARM Ltd Windows GCC C++ Compiler'

"C:/Freescale/CW MCU v10.4/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-g++" "../Sources/application.cpp" @"Sources/application.args" -Wa,-adhlns="Sources/application.o.lst" -MMD -MP -MF"Sources/application.d" -o"Sources/application.o"

../Sources/application.cpp:25:16: error: field 'file_' has incomplete type

mingw32-make: *** [Sources/application.o] Error 1