1

我目前正在尝试做一些简单的 IO,但是我遇到了一些未解决的方法。

#include <iostream>
#include <fstream>

std::string filename = "\random\location\blah";
std::ifstream test;  // is defined
test.open(filename);  //all others not resolvable
bool doesntwork = test.is_open();
bool alsodoesnt = test.good();
test.close();

我目前正在使用 Mingw-w64,我已经签入了 MinGW\lib\gcc\x86_64-w64-mingw32\4.7.2\include\c++\fstream 并且它们用于 basic_ifstream 等成员。

(抱歉忘记编译)

c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/_mingw_secapi.h:47:8: error: expected unqualified-id before string constant
c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/vadefs.h:12:32: error: expected '}' before end of line
c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/vadefs.h:12:32: error: expected unqualified-id before end of line
c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/vadefs.h:12:32: error: expected declaration before end of line

错误1:

#ifdef __cplusplus
extern "C++" {   // the error location, not sure what to do
template <bool __test, typename __dsttype>
 struct __if_array;
template <typename __dsttype>
struct __if_array <true, __dsttype> {
typedef __dsttype __type;
};
}
#endif /*__cplusplus*/

错误 2-4

#ifdef __cplusplus
extern "C" {  //not sure what they wanted here
#endif
4

0 回答 0