问题描述
我是编程的新手,所以我觉得这里缺少一些简单的东西.
I'm new to programming so I feel there is something simple I'm missing here.
我使用的是最新版本的Mac,我刚刚安装了Code :: Blocks和Xcode,因此可以使用gcc编译器.
I'm using the latest version of Mac and I've just installed Code::Blocks along with Xcode so I can use the gcc compiler.
我创建了一个新的控制台应用程序"项目,并显示了一个hello world程序的代码.
I created a new "console application" project and the code for a hello world program shows up.
我构建了这段代码,它给了我0错误和0警告,所以我认为这是一个良好的开端.
I built this code and it gave me 0 errors and 0 warnings so I thought it was off to a good start.
但是当我运行此代码时,在终端窗口中得到的却是以下内容:
But when I go to run this code all I get is the following in my Terminal window:
*/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH = $ DYLD_LIBRARY_PATH:./Users/Ryan/Documents/C ++书籍内容/SayHello/bin/Debug/SayHello
*/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHello
Ryan-McMullens-iMac:〜Ryan $/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH = $ DYLD_LIBRARY_PATH:./Users/Ryan/Documents/C ++书籍内容/SayHello/bin/Debug/SayHellosh:/Users/Ryan/Documents/C ++:没有这样的文件或目录
Ryan-McMullens-iMac:~ Ryan$ /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHellosh: /Users/Ryan/Documents/C++: No such file or directory
进程返回127(0x7F)执行时间:0.003 s按ENTER继续.*
Process returned 127 (0x7F) execution time : 0.003 sPress ENTER to continue.*
我已经检查以确保使用gcc编译器.我也尝试过在我的documents文件夹中创建一个C ++目录,但这没有帮助.
I've checked to make sure its using the gcc compiler. I've also tried creating a C++ directory in my documents folder but that didn't help.
就像我说的那样,我觉得我只是在某个地方缺少一个步骤,因此,任何帮助将不胜感激!
Like I said, I feel like I'm just missing a step somewhere so any help would be really appreciated!
谢谢!
推荐答案
尝试避免在目录名称中使用'+'和空格.
Try avoiding using '+' and spaces in the name of directories.
在运行诸如编译器,链接器之类的外部工具或调用最终可执行文件时,许多程序无法处理路径名的转义.
Many program don't handle escaping of pathnames when running external tools like compiler, linker or when calling the final executable.
这篇关于代码::块执行不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!