School project \ mystery error

Hi all

Thanks in advance for any help you will be willing to lend. I have a completed project for my online C++ class. When building the project I receive the following error:

1>------ Build started: Project: Task_11_02_Ch08, Configuration: Debug Win32 ------
1>  Piecework.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\fstream(890): error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ios(176) : see declaration of 'std::basic_ios<_Elem,_Traits>::basic_ios'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          This diagnostic occurred in the compiler generated function 'std::basic_ifstream<_Elem,_Traits>::basic_ifstream(const std::basic_ifstream<_Elem,_Traits> &)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I am strictly a beginner - and Google has not been of much help. I've been through the code again and again - I'm afraid that I am simply not seeing something obvious...anything any of you can do to shed a little light on this mystery for me would be appreciated. I've placed the project code here:

http://pastebin.com/3x3Ap7L4

(the "TODO" commented sections were what I was responsible for.)
#include "CsvInputFile.cpp" You shouldn't include sources, but header files.
I cannot reproduce your error
i am getting a error like this in my program and have no idea why
could someone please look at my problem
http://www.cplusplus.com/forum/beginner/55894/
your line
1-3-70 I have it switched
sumOfEarnings += amountEarned;

hope this works for you.

I am struggling with 12-02. I can not get it to work. figure it out and I would love to know
I didn't read through the code but since you don't include fstream presumably you are using fstream in
CsvInputFile.cpp. Are you passing a stream by value instead of by reference? This could cause the first error shown for fstream:

'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'


The copy constructor is private on streams precisely to prevent copying as this would result in the pointer to the internal buffer being copied and hence each copy would share the same buffer. If you are passing a stream by value try changing to passing by reference.
Topic archived. No new replies allowed.