Ошибки компилятора стандартной библиотеки из-за #include. Все библиотеки приводят к ошибкам в терминале.C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Ошибки компилятора стандартной библиотеки из-за #include. Все библиотеки приводят к ошибкам в терминале.

Сообщение Anonymous »

Я получаю очень странные ошибки, выдаваемые компилятором g++ в моем очень простом проекте на C++. Следующие ошибки:

In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ios:39,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/ostream:40,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iostream:40,
from findWord.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/ios_base.h: In copy constructor ‘std::basic_ios::basic_ios(const std::basic_ios&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/ios_base.h:790: error: ‘std::ios_base::ios_base(const std::ios_base&)’ is private
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd:47: error: within this context
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd: In copy constructor ‘std::basic_ifstream::basic_ifstream(const std::basic_ifstream&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd:81: note: synthesized method ‘std::basic_ios::basic_ios(const std::basic_ios&)’ first required here
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/streambuf: In copy constructor ‘std::basic_filebuf::basic_filebuf(const std::basic_filebuf&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/streambuf:770: error: ‘std::basic_streambuf::basic_streambuf(const std::basic_streambuf&) [with _CharT = char, _Traits = std::char_traits]’ is private
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd:78: error: within this context
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd: In copy constructor ‘std::basic_ifstream::basic_ifstream(const std::basic_ifstream&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/iosfwd:81: note: synthesized method ‘std::basic_filebuf::basic_filebuf(const std::basic_filebuf&)’ first required here
findWord.cpp: In function ‘int main(int, char**)’:
findWord.cpp:19: note: synthesized method ‘std::basic_ifstream::basic_ifstream(const std::basic_ifstream&)’ first required here


Мой код:

#include
#include
#include
#include

using namespace std;

int main(int argc, char* argv[]){
//a char pointer is a c-string
//the array is just an array of char pointers
//argv[0] = pointer to the word to search for
//argv[1] = pointer to fileNames

//includes program name @ 0, so three args
if (argc == 3){

int wordCounter = 0;

ifstream myFile = ifstream(argv[2]);

if (!myFile){
cout

Подробнее здесь: https://stackoverflow.com/questions/138 ... -in-errors
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»