自動的に再コンパイルされるファイルをディスクに書き込もうとしています。残念ながら、sth は動作していないようで、まだ理解できないエラー メッセージが表示されます (私は C の初心者です :-)。生成された hello.c を手動でコンパイルすると、すべて動作しますか?!
#include <stdio.h>
#include <string.h>
int main()
{
FILE *myFile;
myFile = fopen("hello.c", "w");
char * text =
"#include <stdio.h>\n"
"int main()\n{\n"
"printf(\"Hello World!\\n\");\n"
"return 0;\n}";
system("cc hello.c -o hello");
fwrite(text, 1, strlen(text), myFile);
fclose(myFile);
return 0;
}
これは私が得るエラーです:
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: 関数_start':
(.text+0x20): undefined reference to
main で collect2: ld が 1 つの終了ステータスを返しました