c++ - C ++ ROOT:IncrementalExecutor::executeFunction:链接时符号'_ZStorSt13_Ios_OpenmodeS_'未解析[cling接口函数]
问题描述
我是 C++ 新手,在 Ubuntu 18.04 中使用 CERN ROOT 解释器 6.22/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;
}
但是,当我运行此代码时,出现错误:
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?
我尝试了错误建议并在库中查找std::setw(int)
,但我看到它是在 中定义的<iomanip>
,我已经将其包含在代码中。我在这里想念什么?
解决方案
推荐阅读
- node.js - 可以使用 Reac-native 项目建立到 .net mvc wsdl 的服务连接吗
- java - Fitnesse 中的身份验证不适用于网页
- javascript - 可以在变量中分配 URL 地址并在 HTML 中使用。使用 JavaScript?
- c++ - 为什么我的 switch 语句不能正常工作?
- iis - IIS 中的 ASP.Net core 2.2 部署问题
- c# - UWP 创建应用程序包在发布模式下失败
- android - 应用程序转到 splitView 时如何避免调用 onCreate()
- html - 达到最大宽度时如何在 x 轴上进行行滚动(溢出)
- c# - 类属性中的动态类型
- ios - 在 UIViewController、iOS Swift4.2、Xcode10.1 中只调用一次函数