Code::Blocks isn't executing properly

时光毁灭记忆、已成空白 提交于 2021-02-05 12:31:42

问题


I'm new to programming so I feel there is something simple I'm missing here.

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.

I created a new "console application" project and the code for a hello world program shows up.

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++ 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++ book stuff/SayHello/bin/Debug/SayHello sh: /Users/Ryan/Documents/C++: No such file or directory

Process returned 127 (0x7F) execution time : 0.003 s Press ENTER to continue.*

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!

Thanks!


回答1:


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.




回答2:


Remove spaces from your path. It seems that codeblocks does not quote the paths, so every space will be introducing a new command or parameter. The problem here is this part:

C++ book

because it has a whitespace.



来源:https://stackoverflow.com/questions/30425236/codeblocks-isnt-executing-properly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!