I'm trying to create a cross-platform program. I just created a class and made a function which gets the path of the current user. I wanted to use that path later. But somehow I get these errors :
"/usr/include/x86_64-linux-gnu/sys/stat.h:-1: In member function 'void FileManager::p_getfilepath()':"
"/usr/include/x86_64-linux-gnu/sys/stat.h:105: error: expected unqualified-id before string constant"
"/home/david/VocabularyTrainer/filemanager.cpp:31: error: expected '}' at end of input"
btw the 31th line is the last line here in this code :
void FileManager::p_getfilepath() { #ifdef Q_OS_WIN32 #include <windows.h> #endif #ifdef Q_OS_LINUX #include <sys/stat.h> struct passwd *p; uid_t uid; if ((p = getpwuid(uid = geteuid())) == NULL) { QMessageBox* mb; mb->setText(""); mb->exec(); delete mb; } else { filepath = p->pw_dir; } #endif } Anyone knows what's wrong? I'm on linux mint.