Каждый раз, когда я делаю новый проект в Eclipse Oxygen CDT, меня всегда преследуют три основные ошибки: «Тип ‘std :: string’ не может быть решен» (или аналогичные проблемы с включением), «Ошибка запуска. Двоичные файлы не найдены, msgstr «и» Ошибка запуска. Программный файл не существует «.
Я чувствую, что попробовал почти все. Я исследовал и следил за этими вопросами: Eclipse C ++: символ ‘std’ не может быть разрешен
, Файл программы, указанный в конфигурации запуска, не существует, Не удалось запустить бинарный файл Eclipse для C в Windows
, Проект Eclipse CDT построен, но «Launch Failed. Двоичный файл не найден »
, Ошибка «не удалось разрешить строку» в Eclipse для C ++ (Eclipse не может разрешить стандартную библиотеку)
, C ++ — неразрешенное включение: iostream
, Eclipse c ++ Type не удалось устранить ошибку, даже если сборка прошла успешно
, а также Как включить файл из другой папки?
.
Привет Мир Пример:
/*
* Hi_world.cpp
*
* Created on: Feb 22, 2018
* Author: Me
*/
//I tried using the actual file paths but that didn't help either
#include <C:\MinGW\lib\gcc\mingw32\5.3.0\include\c++\iostream>
#include <C:\MinGW\include\string.h>
using namespace std;//"Symbol 'std' could not be resolved"
int main()
{
std::string me = "hi world";//"Type 'std::string' could not be resolved"
std::cout << me << std::endl;//"Symbol 'cout' could not be resolved"// and "Symbol 'endl' could not be resolved"}
Примечание: я пытался заставить его работать несколько часов один день, но безуспешно, поэтому я сохранил и вышел из Eclipse и моего компьютера. На следующий день я включил компьютер, почистил, собрал и запустил эту программу как есть, и она сработала с первой попытки (хотя красные волнистые линии не исчезли).
Слушайте это журнал сборки программ:
12:37:15 **** Rebuild of configuration Debug for project Hi world ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o Hi_world.o "..\\Hi_world.cpp"g++ "-LC:\\MinGW" -o "Hi world.exe" Hi_world.o
12:37:17 Build Finished (took 1s.47ms)
Слушайте, это еще один пример, который по-прежнему не работает:
#include <iostream>
#include "stdio.h"#include "time.h"#include "string.h"
int main ()
{
time_t timer;
struct tm y2k = {0};
double seconds;
y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0;
y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1;
time(&timer); /* get current time; same as: timer = time(NULL) */
seconds = difftime(timer,mktime(&y2k));
printf ("%.f seconds since January 1, 2000 in the current timezone", seconds);
return 0;
}
Примечание: здесь были все ошибки включения, упомянутые ранее, но случайным образом между чистым и восстановленным эти красные ошибки исчезли. Однако он по-прежнему не собирается и не работает правильно с сообщением об ошибке «Запуск не выполнен. Двоичный файл не найден».
Слушайте это журнал сборки программ:
12:40:10 **** Rebuild of configuration Debug for project Time ****
Info: Internal Builder is used for build
g++ "-IC:\\MinGW\\lib\\gcc\\mingw32\\5.3.0\\include\\c++\\debug" -O0 -g3 -Wall -c -fmessage-length=0 -o Time.o "..\\Time.cpp"In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h: In member function 'std::__cxx11::string std::__cxx11::numpunct<_CharT>::grouping() const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:1777:7: error: return type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}' is incomplete
{ return this->do_grouping(); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h: In member function 'virtual std::__cxx11::string std::__cxx11::numpunct<_CharT>::do_grouping() const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:1845:7: error: return type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}' is incomplete
{ return _M_data->_M_grouping; }
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'void std::__numpunct_cache<_CharT>::_M_cache(const std::locale&)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:88:26: error: invalid use of incomplete type 'const string {aka const class std::__cxx11::basic_string<char>}'
_M_grouping_size = __g.size();
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:90:7: error: invalid use of incomplete type 'const string {aka const class std::__cxx11::basic_string<char>}'
__g.copy(__grouping, _M_grouping_size);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function '_InIter std::num_get<_CharT, _InIter>::_M_extract_float(_InIter, _InIter, std::ios_base&, std::ios_base::iostate&, std::__cxx11::string&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:211:18: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__found_grouping.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:282:10: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.clear();
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:296:27: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:319:27: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size() && !__found_dec)
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:355:27: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function '_InIter std::num_get<_CharT, _InIter>::_M_extract_int(_InIter, _InIter, std::ios_base&, std::ios_base::iostate&, _ValueT&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:468:20: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__found_grouping.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:554:22: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:567:55: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if ((!__sep_pos && !__found_zero && !__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, float&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:695:13: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:697:33: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, double&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:710:13: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:712:33: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, long double&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:742:13: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:744:33: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
12:40:10 Build Finished (took 656ms)
Я использую собственную версию Windows 10 и использую MinGW, установленную на моем компьютере. Что странного в этой проблеме, так это то, что я начну новый проект, появятся ошибки включения, из-за чего он не сможет быть собран или запущен, и, таким образом, из-за двух других ошибок я буду бороться с ним в течение нескольких дней, следуя ответы выше и не получить где. Затем, на ровном месте, я нажму «построить и запустить», и программа будет собираться правильно и работать правильно (до тех пор, пока я не изменю код или после этого не нажму «Очистить»). Будет еще хуже, если я попытаюсь создать класс и включить заголовочный файл классов со всеми объявлениями методов в файл .cpp классов с похожими ошибками в файле .cpp, как в примере выше.
Может ли это быть вызвано неисправной изоляцией Eclipse CDT или MinGW? Есть ли в Eclipse настройки, которые я мог бы изменить, чтобы указать, где искать его библиотеки (это даже поможет?)? Любая помощь очень ценится =).
Спасибо!
Задача ещё не решена.
Других решений пока нет …