OK I think I figured this out. The issue was code being #ifdef'd out due to global settings in various CW setup files. By turning on file support I got it to compile. Here's the source code, the comments at top show what I changed to get it to work:
/*
* main implementation: use this 'C++' sample to create your own application
*
*/
/*
notes: in file ewlconfig_ARM changed:
// #define _EWL_NO_FILE_IO //commented
#define _EWL_CFILE_STREAM //uncommented
in file ansi_prefix.ARM.h changed:
#define _EWL_NO_WCHART_C_SUPPORT //added
*/
#include <niostream> // iostream has wide char support i don't care about
#include <fstream>
#include <cstdlib>
#include <cstdio>
class counterclass
{
private:
int m_counter;
public:
counterclass(void)
{
m_counter = 0;
};
void increment(void)
{
m_counter++;
};
std::ifstream *file_; //works
std::ifstream file1_(); //works
std::ifstream file2_; //doesnt work ("field file1_ has incomplete type")
};
int main()
{
counterclass myccounter;
for(;;) {
myccounter.increment();
}
return 0;
}
extern "C"
{
#include <sys/UART.h>
/****************************************************************************/
/*
* Implementation for CodeWarror MSL interface to serial device (UART.h).
* Needed for printf, etc...
* Only InitializeUART, ReadUARTN, and WriteUARTN are implemented.
*
*/
UARTError InitializeUART(UARTBaudRate baudRate)
{
//todo: add functionality if used
return kUARTNoError;
}
/****************************************************************************/
/*
ReadUARTN
Read N bytes from the UART.
bytes pointer to result buffer
limit size of buffer and # of bytes to read
*/
/****************************************************************************/
UARTError ReadUARTN(void* bytes, unsigned long limit)
{
//todo: add functionality if used
return kUARTNoError;
}
/****************************************************************************/
UARTError WriteUARTN(const void* bytes, unsigned long length)
{
//todo: add functionality if used
return kUARTNoError;
}
} // extern C