Thread: compile error

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    35

    compile error

    heyas,

    i know this is a very big ask, but im recieving the following error and its driving me n_u_t_s. ill post both the error and the class that's causing it, any assistance or suggestions would be much appreciated. also if anyone can tell me how to identify and read these types of errors i'd be very thankful.

    tia
    -twans

    Code:
    /usr/include/g++/bits/ios_base.h: In copy constructor `std::basic_ios<char,
       std::char_traits<char> >::basic_ios(const std::basic_ios<char,
       std::char_traits<char> >&)':
    /usr/include/g++/bits/ios_base.h:668: error: `std::ios_base::ios_base(const
       std::ios_base&)' is private
    PlayFileMAPRecord.cc:69: error: within this context
    /usr/include/g++/streambuf: In copy constructor `std::basic_filebuf<char,
       std::char_traits<char> >::basic_filebuf(const std::basic_filebuf<char,
       std::char_traits<char> >&)':
    /usr/include/g++/streambuf:921: error: `std::basic_streambuf<_CharT,
       _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&)
       [with _CharT = char, _Traits = std::char_traits<char>]' is private
    PlayFileMAPRecord.cc:69: error: within this context
    
    
    **************************************************************************
    class
    **************************************************************************
    
    #include "PlayFileMAPRecord.h"
    
    #include<iostream>
    #include <fstream>
    
    
    
    using namespace std;
    
    
    
    PlayFileMAPRecord::PlayFileMAPRecord(void){
    
               // default constructor
    
    }
    
    
    
    PlayFileMAPRecord::PlayFileMAPRecord(string pFileName){
    
    
    	sizeLines=0;
    	char line[10000];
    
            filename = pFileName;
    	//open passed filename
    
    	fileIn.open(pFileName.c_str());
    
    
    
                    while(!fileIn.eof()){
    			fileIn.getline(line,'\n');
    
    
    
    			//increments counter to get valid size value                	
    			sizeLines++;
    
    		}
    
    
            //close file -reading complete
    	fileIn.close();
    
    }
    
    int
    
    PlayFileMAPRecord::size(void) const {
    
            return sizeLines;
    
    }
    
    
    void
    
    PlayFileMAPRecord::print(void) const {
    
           cout << myLine;
    
    }
    
    
    ostream&
    
    PlayFileMAPRecord::operator<<(ostream& o) {
    
           this->print();
    
    }
    
    PlayFileMAPRecord
    PlayFileMAPRecord::operator[](int index) const{
    	sizeLines=0;
    	char line[10000];
    
    	//open passed filename
    
    	fileIn2.open(filename.c_str());
    
    
    
                    while(!fileIn2.eof()){
    			
    			fileIn2.getline(line,'\n');
    
    			sizeLines++;
    			if(sizeLines==index) {
    				myLine = line;
    				//close file -reading complete
    				fileIn2.close();
    				return *this;  
    			}            	
    			
    
    		}
    
    
            //close file -reading complete (nothing found)
    	fileIn2.close();
    }

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    fileIn.getline(line, 10000);
    fileIn2.getline(line, 10000);
    Last edited by 7stud; 05-20-2005 at 03:02 AM.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    35
    thanks for your reply,

    it made no effect on the errors however.

    just out of curisity will it take the first 10000 lines OR newline, which ever is first? i cannot guarentee anything other than the line will not exceed that many chars..

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> return *this;
    Your class contains stream objects which cannot be copied.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 07:17 PM
  4. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM