解決策がわからない非常に具体的なC++コンパイル構文エラー:私はC ++にかなり慣れておらず、パラメーターとして渡される関数について調べています。コードを何度も読んだので、コンパイルエラーは私には意味がありません。助けてください。
編集:私はwaitpid(pid_t、int、int)を削除し、system()コマンドだけで立ち往生しました。みんな助けてくれてありがとう。
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
int main(){
/* puts apt-get purge text into ~$ purge_e_output */
system("sudo apt-get purge enlightenment > purge_e_output.txt");
system("echo **Pid of apt-get**");
system("pidof apt-get");
try{
pid_t waitpid(pid_t getpid("apt-get"), int *statusPtr, int WUNTRACED);
} catch(...){}
system("echo **REMOVING ENGLIGHTENMENT**");
system("sudo apt-get purge enlightenment");
system("pidof apt-get");
try{
pid_t waitpid(pid_t getpid("apt-get"), int *statusPtr, int WUNTRACED);
} catch(...){}
/* puts apt-get autoremove text into ~$ autoremove_e_output */
system("sudo apt-get autoremove > autoremove_e_output.txt");
system("echo **Pid of apt-get**");
system("pidof apt-get");
try{
pid_t waitpid(pid_t getpid("apt-get"), int *statusPtr, int WUNTRACED);
} catch(...){}
system("echo **REMOVING E DATA**");
system("sudo apt-get autoremove");
system("echo **Pid of apt-get**");
system("pidof apt-get");
try{
pid_t waitpid(pid_t getpid("apt-get"), int *statusPtr, int WUNTRACED);
} catch(...){}
/* puts apt-get autoclean text into ~$ autoclean_e_output */
system("sudo apt-get autoclean > autoclean_e_output.txt");
system("echo **Pid of apt-get**");
system("pidof apt-get");
try{
pid_t waitpid(pid_t getpid("apt-get"), int *statusPtr, int WUNTRACED);
} catch(...){}
system("echo **CLEANING**");
system("sudo apt-get autoclean");
system("echo **Pid of apt-get**");
system("pidof apt-get");
try{
pid_t waitpid(pid_t getpid("apt-get"), int *statusPtr, int WUNTRACED);
} catch(...){}
/* reinstall englightenment */
system("echo **REINSTALLING**");
system("sudo apt-get install enlightenment");
system("echo **Pid of apt-get**");
system("pidof apt-get");
try{
pid_t waitpid(pid_t getpid("apt-get"), int *statusPtr, int WUNTRACED);
} catch(...){}
/* logs */
system("echo && echo Logs for wtf just happened:");
system("echo && echo ~$ purge_e_output.txt && echo ~$ autoremove_e_output.txt && echo ~$ autoclean_e_output.txt");
}
コンパイルエラー:
~$ g++ JIC.cpp -o JIC
JIC.cpp: In function ‘int main()’:
JIC.cpp:12: error: expected ‘,’ or ‘...’ before ‘(’ token
JIC.cpp:18: error: expected ‘,’ or ‘...’ before ‘(’ token
JIC.cpp:26: error: expected ‘,’ or ‘...’ before ‘(’ token
JIC.cpp:34: error: expected ‘,’ or ‘...’ before ‘(’ token
JIC.cpp:42: error: expected ‘,’ or ‘...’ before ‘(’ token
JIC.cpp:49: error: expected ‘,’ or ‘...’ before ‘(’ token
JIC.cpp:58: error: expected ‘,’ or ‘...’ before ‘(’ token