Author Topic: "No such file or directory" Mac OS X 10.9.1  (Read 22310 times)

grant.s

  • Guest
"No such file or directory" Mac OS X 10.9.1
« 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.  :)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353

grant.s

  • Guest
Re: "No such file or directory" Mac OS X 10.9.1
« Reply #2 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?
« Last Edit: February 24, 2014, 08:33:32 am by grant.s »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: "No such file or directory" Mac OS X 10.9.1
« Reply #3 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

grant.s

  • Guest
Re: "No such file or directory" Mac OS X 10.9.1
« Reply #4 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: "No such file or directory" Mac OS X 10.9.1
« Reply #5 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?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

grant.s

  • Guest
Re: "No such file or directory" Mac OS X 10.9.1
« Reply #6 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"
« Last Edit: February 24, 2014, 10:26:11 am by grant.s »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: "No such file or directory" Mac OS X 10.9.1
« Reply #7 on: February 24, 2014, 08:37:48 pm »
Try to compile something on the command line and verify that your compiler works.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]