Code::Blocks Forums

User forums => Help => Topic started by: grant.s on February 19, 2014, 09:55:26 pm

Title: "No such file or directory" Mac OS X 10.9.1
Post by: grant.s on February 19, 2014, 09:55:26 pm
Hi,

I'm trying to set up Code::Blocks on my Mac for school use. I've been trying to run Hello World with no success. I have read that Macs have an issue dealing with spaces in file names so I have already avoided that. I also downloaded Xcode and the command line tools that are apparently  required for Code::Blocks to work properly. Lastly, this is the current code I'm using for my "Terminal to launch programs":
Code
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "exe=\'$SCRIPT\'; cd \\"${exe%/*/*/*}\\"; clear; \\"${exe% }\\"; echo - e \'Press any key to continue...\'; read -n 1; osascript -e \'tell app \\"CodeBlocks\\" to activate\'; exit"' -e 'end tell'

This is what is being displayed in the terminal when I hit Build & Run for "Hello World":
Code
Last login: Wed Feb 19 12:51:17 on ttys001
exe='/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/grantshipp/Documents/School/compsci/helloworld/bin/Debug/helloworld '; cd "${exe%/*/*/*}"; clear; "${exe% }"; echo - e 'Press any key to continue...'; read -n 1; osascript -e 'tell app "CodeBlocks" to activate'; exit
grants-mbp:~ grantshipp$ exe='/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/grantshipp/Documents/School/compsci/helloworld/bin/Debug/helloworld '; cd "${exe%/*/*/*}"; clear; "${exe% }"; echo - e 'Press any key to continue...'; read -n 1; osascript -e 'tell app "CodeBlocks" to activate'; exit
-bash: cd: /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/grantshipp/Documents/School/compsci/helloworld: No such file or directory










-bash: /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/grantshipp/Documents/School/compsci/helloworld/bin/Debug/helloworld: No such file or directory
- e Press any key to continue...

If anyone could help me out it'd be greatly appreciated.  :)
Title: Re: "No such file or directory" Mac OS X 10.9.1
Post by: BlueHazzard on February 20, 2014, 01:39:53 am
may be it is a compiling problem?
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
Title: Re: "No such file or directory" Mac OS X 10.9.1
Post by: grant.s on February 24, 2014, 08:31:44 am
I've managed to get past the issue posted in my OP (or just masked it with another issue, let's hope that's not the case) but now I'm facing another one.

When I try to run the standard hello world script, this is what is being returned in the build log.

Code
-------------- Build: Debug in helloworld (compiler: GNU GCC Compiler)---------------

g++ -L/usr/lib -o bin/Debug/helloworld obj/Debug/main.o  
Undefined symbols for architecture x86_64:
  "std::ostream::operator<<(std::ostream& (*)(std::ostream&))", referenced from:
      _main in main.o
  "std::ios_base::Init::Init()", referenced from:
      ___cxx_global_var_init in main.o
  "std::ios_base::Init::~Init()", referenced from:
      ___cxx_global_var_init in main.o
  "std::cout", referenced from:
      _main in main.o
  "std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
      _main in main.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Any clue what the issue might be and how I can fix it?
Title: Re: "No such file or directory" Mac OS X 10.9.1
Post by: oBFusCATed on February 24, 2014, 09:25:22 am
You're probably mixing clang and GCC executables. Why have you setup g++ for linking? You have to probably set it to clang.
Title: Re: "No such file or directory" Mac OS X 10.9.1
Post by: grant.s on February 24, 2014, 09:43:09 am
I haven't touched any of the compiler settings besides adding some compiler and linker search directories. For compiler search directories I added:
/usr/include
/usr/include/c++/4.2.1

and linker search directory:
/usr/lib

"Toolchain executables" looks like this: http://i61.tinypic.com/2lcqwr6.png

You're probably mixing clang and GCC executables. Why have you setup g++ for linking? You have to probably set it to clang.
Is there any other steps to that other than changing the field for linker for dynamic files to clang?
Title: Re: "No such file or directory" Mac OS X 10.9.1
Post by: oBFusCATed on February 24, 2014, 10:03:16 am
I haven't touched any of the compiler settings besides adding some compiler and linker search directories. For compiler search directories I added:
/usr/include
/usr/include/c++/4.2.1

and linker search directory:
/usr/lib
Remove these, the compiler must automatically add them.
Does GCC work if you execute some simple commands in a terminal?
Title: Re: "No such file or directory" Mac OS X 10.9.1
Post by: grant.s on February 24, 2014, 10:23:34 am
I went ahead and removed those, still getting same results. Yes, GCC seems to work when I type commands like "gcc --version" and "gcc --help"
Title: Re: "No such file or directory" Mac OS X 10.9.1
Post by: oBFusCATed on February 24, 2014, 08:37:48 pm
Try to compile something on the command line and verify that your compiler works.