非静态成员函数的使用无效(while loop/no class/wget popen)
invalid use of non-static member function (while loop/no classes/wget popen)
免责声明:我不知道自己在做什么&试图通过此操作来搜索我的方式;
编译器错误;
main.cpp: In function ‘int sourcePull()’:
main.cpp:35:28: error: invalid use of non-static member function
system(command.c_str + source);
^
源函数;
#include <cstdio>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
int sourcePull()
{
string source;
string command;
command = "wget -np -a source.log ";
ifstream sourceFile ("sources.txt");
if (sourceFile.is_open())
{
while (sourceFile.good())
{
while (sourceFile >> source)
{
//system(command.c_str + source);
FILE* file = popen(command.c_str + source, "r");
}
sourceFile.close();
}
}
return 0;
}
当我没有课程作为成员时,"源"将如何成为成员函数。
尝试将"源"作为指针(*源),引用源(&amp; source),没有骰子...
感谢提前的任何帮助。
我认为你的意思是
FILE* file = popen((command.c_str() + source).c_str(), "r");
^^^^
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- 为什么我不能在 FOR LOOP 中使用 i/10,C++?
- Arduino:for/while/if在void setup()或void loop()之前?——错误:之前需要不合格
- c++20[[no.unique_address]]中的新功能是什么
- 以线程安全的方式调用"QQuickPaintedItem::updateImage(const QImage&image)"(no QThread)
- "no matching function for call to 'Vector::Vector'"错误
- Android NDK clang 编译器错误在 Windows 上显示'No such file or directory'
- "Ill-defined for-loop - loop executes infinitely" (MSVC C6295)
- 处理"no operator found"
- 我在 ifstream input_file(文件名)行中收到错误"no matching function to call";
- Arduino:在 loop() 和自定义函数中运行相同的代码时出现问题
- 如何解决"no Qt platform plugin could be initialized"问题?
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- 为什么当我在 std::string 中打开文件名的 fstream 时出现"no matching function"错误?
- 已解决 - C++ 的崇高文本中的"fatal error: opencv: no such file or directory"
- do while 循环中的 if 语句以 yes 或 no 结尾
- 从 TVector2 类派生复杂类:"No matching function for call to Complex::Complex()"
- 错误消息:使用"string* +="后"no match for 'operator+='"
- 非静态成员函数的使用无效(while loop/no class/wget popen)