Compiling simple Hello World program on OS X via command line

后端 未结 8 956
梦如初夏
梦如初夏 2020-12-22 16:35

I\'ve got a simple hello world example that I\'m trying to compile on OS X, named hw.cpp:

#include 
#include 
usin         


        
相关标签:
8条回答
  • 2020-12-22 17:27

    You didn't specify what the error you're seeing is.

    Is the problem that gcc is giving you an error, or that you can't run gcc at all?

    If it's the latter, the most likely explanation is that you didn't check "UNIX Development Support" when you installed the development tools, so the command-line executables aren't installed in your path. Re-install the development tools, and make sure to click "customize" and check that box.

    0 讨论(0)
  • 2020-12-22 17:30
    user@host> g++ hw.cpp
    user@host> ./a.out
    
    0 讨论(0)
提交回复
热议问题