Witam. Mam problem z kodem c++, gdyż poniższy kod działa na systemie windows, a na linuxie jest błąd kompilacji:
#include <iostream>
#include <string>
#include <fstream>
#include <filesystem>
#include <sstream>
#include <bits/stdc++.h>
#include <iostream>
#include <sys/stat.h>
#include <sys/types.h>
namespace fs = std::filesystem;
using namespace std;
void Directory::CreateDirectory(string Path) {
const char* c = Path.c_str();
if (mkdir(c) == -1)
cerr << "Error : " << strerror(errno) << endl;
else
cout << "Directory "<<Path<<" created";
}
void Directory::RemoveDirectory(string Path) {
const char* c = Path.c_str();
if (rmdir(c) == -1)
cerr << "Error : " << strerror(errno) << endl;
else
cout << "Directory " << Path << " removed";
}
Błąd nr 1: too few arguments to function ‘int mkdir(const char*, __mode_t)’.
Błąd nr 2: ‘rmdir’ was not declared in this scope.
Na obydwu systemach kompilowane tym samym poleceniem, tj. g++ -std=c++17 ./src/*.cpp -o ./out/main, na windowsie działa, na linuxie nie.