[英]C++ "Entry Point Not Found" when trying to write to file
我正在尝试用 C++ 写入文件,但是一旦我运行我的 .exe 文件,我就会收到以下错误
“ The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library C:/Users...
”
这是我的代码
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
ofstream outfile ("test.txt");
outfile << "Hello World\n"; // error happens here
return 0;
}
我设法通过将 libstdc++-6.dll 从C:\\MinGW\\bin
复制到我的项目目录中来解决这个问题!
试试这个代码
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
int main()
{
ofstream outfile;
outfile.open("text.txt")//opening the file
outfile<<"Hello world";
outfile.close();//closing the file
return 0;
}
每当我们处理文件时,都应该打开文件和关闭文件。 对于这个程序,主函数中的参数是不需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.