C++;ROOT:IncrementalExecutor::executeFunction:symbol'_ZStorSt13 Ios OpenmodeS';链接[cling interface function]时未解析 我是新的C++,AM使用了Ubuntu 18.04中的CERN根解释器622/00(当然是必修的)。我试图编写一个代码,简单地从文件中读取数据列,然后将数据写入输出文件。这是我的代码的一个可复制的最低版本,我从数组而不是文件中读取: # include <iostream> # include <fstream> //# include <math.h> # include <iomanip> //# include <cmath> //# include <stdlib.h> # include <cstdlib> //# include <fstream.h> //# include <string.h> # include <string> //# include <direct.h> //# include <dos.h> //For Sleep() using namespace std; int main() { char outputFileName[30] = "output.dat"; int NumOfRows = 5; int nCount[5] = {0, 1, 2, 3, 4}; int nCount2[5] = {1, 2, 3, 4, 5}; cout<<"Creating output file"<<endl; ofstream outFile(outputFileName); outFile<<"1st Param"<<setw(15)<<"2nd Param"<<endl; //Header for (int a = 1; a < NumOfRows; a++){ // Reading rest of file outFile << nCount[a] << nCount2[a]; } outFile<<""<<endl; // Warning if file cant be opened if(!outFile.is_open()){ cout << "Error opening file. \n"; //cout << "Giving Retry... \n"; } if(outFile.is_open()){ cout<<"Output File was opened successfully"<<endl; } if(outFile.good()){ cout<<"Output File is ready for reading"<<endl; } outFile.close(); if(!outFile.is_open()){ cout<<"Output File closed successfully"<<endl; } return 0; }

C++;ROOT:IncrementalExecutor::executeFunction:symbol'_ZStorSt13 Ios OpenmodeS';链接[cling interface function]时未解析 我是新的C++,AM使用了Ubuntu 18.04中的CERN根解释器622/00(当然是必修的)。我试图编写一个代码,简单地从文件中读取数据列,然后将数据写入输出文件。这是我的代码的一个可复制的最低版本,我从数组而不是文件中读取: # include <iostream> # include <fstream> //# include <math.h> # include <iomanip> //# include <cmath> //# include <stdlib.h> # include <cstdlib> //# include <fstream.h> //# include <string.h> # include <string> //# include <direct.h> //# include <dos.h> //For Sleep() using namespace std; int main() { char outputFileName[30] = "output.dat"; int NumOfRows = 5; int nCount[5] = {0, 1, 2, 3, 4}; int nCount2[5] = {1, 2, 3, 4, 5}; cout<<"Creating output file"<<endl; ofstream outFile(outputFileName); outFile<<"1st Param"<<setw(15)<<"2nd Param"<<endl; //Header for (int a = 1; a < NumOfRows; a++){ // Reading rest of file outFile << nCount[a] << nCount2[a]; } outFile<<""<<endl; // Warning if file cant be opened if(!outFile.is_open()){ cout << "Error opening file. \n"; //cout << "Giving Retry... \n"; } if(outFile.is_open()){ cout<<"Output File was opened successfully"<<endl; } if(outFile.good()){ cout<<"Output File is ready for reading"<<endl; } outFile.close(); if(!outFile.is_open()){ cout<<"Output File closed successfully"<<endl; } return 0; },c++,root-framework,C++,Root Framework,我尝试了错误建议,并在库中查找std::setw(int),但我发现它是在中定义的,我已经在代码中包含了它。我遗漏了什么?这是否回答了你的问题@用户4581301如果此处不需要,您认为我应该省略一些#includes吗?我对includes的看法是总是包含您使用的所有内容的标题,不多也不少。您是如何运行代码的?解释(从命令行>根YouFr.C. >您的文件.C. > />代码> .xYouFr.c>根/文件> C+ >代码> > L YouField.C+ > />代码> .x YouFr.C+

我尝试了错误建议,并在库中查找
std::setw(int)
,但我发现它是在
中定义的,我已经在代码中包含了它。我遗漏了什么?

这是否回答了你的问题@用户4581301如果此处不需要,您认为我应该省略一些
#includes
吗?我对includes的看法是总是包含您使用的所有内容的标题,不多也不少。您是如何运行代码的?解释(从命令行>根YouFr.C.<代码> >您的文件.C.<代码> > />代码> .xYouFr.c>根/文件> C+<代码> >代码> > L YouField.C+<代码> > />代码> .x YouFr.C+<代码>,或编译为“正常”C++应用程序>代码> G++YouFr.C.$(root-config--cflags)$(root-config--libs)?)@user4581301有根框架标签。由于模棱两可,它甚至与根标签的描述相链接。它描述了在哪里可以找到根支持论坛(在工作时间,有员工付费回答问题)
IncrementalExecutor::executeFunction: symbol '_ZStorSt13_Ios_OpenmodeS_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::operator|(std::_Ios_Openmode, std::_Ios_Openmode)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZSt4setwi' unresolved while linking [cling interface function]!
You are probably missing the definition of std::setw(int)
Maybe you need to load the corresponding shared library?