0
我想編譯一個使用線程的hello世界程序。但我一直得到同樣的錯誤,我嘗試過不同的方式,但沒有運氣。如何編譯線程程序?
gcc hello.c -o hello -lpthread // command line compilation
./hello.c // execution
-bash: ./hello.c: Permission denied // error message
我想編譯一個使用線程的hello世界程序。但我一直得到同樣的錯誤,我嘗試過不同的方式,但沒有運氣。如何編譯線程程序?
gcc hello.c -o hello -lpthread // command line compilation
./hello.c // execution
-bash: ./hello.c: Permission denied // error message
-o選項重命名爲任何你寫下一個可執行文件(在這種情況下,「你好」)。你需要執行./hello而不是./hello.c。
您不運行.c或.o文件;你必須創建一個可執行文件。閱讀「Hello world」教程中的下一步。 – duffymo