41 / 41 / 11
Регистрация: 02.04.2016
Сообщений: 313
|
|
1 | |
CLine\MinGW - не работает cin, cout29.07.2016, 21:14. Показов 5562. Ответов 3
Метки нет (Все метки)
По совету знакомого попробовал установить CLine. Скачал компилятор MinGW, открыл IDE, но даже тестовый пример не запускается:
Кликните здесь для просмотра всего текста
Код
"C:\CLion 1.2.1\bin\cmake\bin\cmake.exe" --build C:\Users\Lyosha\.CLion12\system\cmake\generated\4072c117\4072c117\Debug --target all -- -j 2 [ 50%] Building CXX object CMakeFiles/Test.dir/main.cpp.obj In file included from c:\mingw\include\wchar.h:208:0, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39, from C:\Test\main.cpp:1: c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:173:14: error: '_mode_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:173:14: error: '_off_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type struct _stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: '_ino_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: '_mode_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: '_off_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type struct stat __struct_stat_defined( _off_t, time_t ); ^ c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type struct _stati64 __struct_stat_defined( __off64_t, time_t ); ^ c:\mingw\include\sys/stat.h:188:17: error: '_ino_t' does not name a type struct _stati64 __struct_stat_defined( __off64_t, time_t ); ^ c:\mingw\include\sys/stat.h:188:17: error: '_mode_t' does not name a type struct _stati64 __struct_stat_defined( __off64_t, time_t ); ^ c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type struct _stati64 __struct_stat_defined( __off64_t, time_t ); ^ c:\mingw\include\sys/stat.h:188:17: error: '__off64_t' does not name a type struct _stati64 __struct_stat_defined( __off64_t, time_t ); ^ c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type struct _stati64 __struct_stat_defined( __off64_t, time_t ); ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long long unsigned int std::stoull(const string&, std::size_t*, int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2878:31: error: 'strtoull' is not a member of 'std' { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'float std::stof(const string&, std::size_t*)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2884:31: error: 'strtof' is not a member of 'std' { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long double std::stold(const string&, std::size_t*)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2892:31: error: 'strtold' is not a member of 'std' { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2899:45: error: 'vsnprintf' is not a member of 'std' { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(int), ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(unsigned int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2904:45: error: 'vsnprintf' is not a member of 'std' { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2910:45: error: 'vsnprintf' is not a member of 'std' { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 * sizeof(long), ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long unsigned int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2915:45: error: 'vsnprintf' is not a member of 'std' { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long long int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2921:45: error: 'vsnprintf' is not a member of 'std' { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long long unsigned int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2927:45: error: 'vsnprintf' is not a member of 'std' { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(float)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2936:45: error: 'vsnprintf' is not a member of 'std' return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(double)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2945:45: error: 'vsnprintf' is not a member of 'std' return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'std::string std::to_string(long double)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2954:45: error: 'vsnprintf' is not a member of 'std' return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n, ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long long int std::stoll(const wstring&, std::size_t*, int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2976:31: error: 'wcstoll' is not a member of 'std' { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long long unsigned int std::stoull(const wstring&, std::size_t*, int)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2981:31: error: 'wcstoull' is not a member of 'std' { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'float std::stof(const wstring&, std::size_t*)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2987:31: error: 'wcstof' is not a member of 'std' { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } ^ c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h: In function 'long double std::stold(const wstring&, std::size_t*)': c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\basic_string.h:2995:31: error: 'wcstold' is not a member of 'std' { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } ^ CMakeFiles\Test.dir\build.make:61: recipe for target 'CMakeFiles/Test.dir/main.cpp.obj' failed CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/Test.dir/all' failed mingw32-make.exe[2]: *** [CMakeFiles/Test.dir/main.cpp.obj] Error 1 mingw32-make.exe[1]: *** [CMakeFiles/Test.dir/all] Error 2 Makefile:82: recipe for target 'all' failed mingw32-make.exe: *** [all] Error 2 Если забыть про cout и использовать printf, то, вроде, работает. Но почему не работает пример "из коробки"? Находил, что нужно вписать std=c++11 вместо -std=gnu++11 (или наоборот) в CMake, но эффекта нет. Вписывал в поле CMAKE_CXX_FLAGS. Помогите пожалуйста решить проблему.
0
|
29.07.2016, 21:14 | |
Ответы с готовыми решениями:
3
Cin-Cout Не работает!!! Как работает cin.peek, cin,get, cin.ignore, cin.clear? Не работает std::cout || std::cin Cin cout |
29.07.2016, 21:28 | 2 |
Сообщение было отмечено Lyosha12 как решение
Решение
Наоборот.
Как? Код
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") #... а лучше полную пересборку, снеся кеш cmake. Добавлено через 2 минуты Ой, возьмите версию поновее, в этой могут быть неожиданные баги, например, отсутствие вывода приложения
1
|
41 / 41 / 11
Регистрация: 02.04.2016
Сообщений: 313
|
|
29.07.2016, 21:42 [ТС] | 3 |
Это самая новая, к которой я нашёл кряк
Ок, нашёл где эту штуку вписывать. Теперь работает, благодарю.
0
|
29.07.2016, 21:44 | 4 |
1
|
29.07.2016, 21:44 | |
29.07.2016, 21:44 | |
Помогаю со студенческими работами здесь
4
cin cout Cout cin операторы cin, cout Ругается на cin cout Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |