Author Topic: Issue running after build  (Read 9111 times)

Offline progr@mm1nG3niu5

  • Single posting newcomer
  • *
  • Posts: 4
Issue running after build
« on: January 17, 2011, 02:18:47 am »
Hey everyone,
I want to make sure I'm providing enough detail, so please bare with the length...


I am using Mac OS X 10.6.6

I am using Code Block 10.05

I am using the simplest code known to everyone and it will not even run that (well, I think it's running, but it will not show the execution of 'hello world').  See below:

#include <iostream>

using namespace std;

int main ()

{ cout << "Hello world!" << endl;

return 0; }


when I hit build/run, I get 0 warnings/errors, but when my terminal opens, it shows the following:


Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ ALL-IN-ONE-DUMMY/first project - hello/Hello /bin/Debug/Hello 
-bash: /Users/adrianhogg/Documents/C++: No such file or directory
Adrian-Hoggs-MacBook:~ adrianhogg$

My terminal is also showing 'bash' for some reason.


Code Block advised I download the Mac OS X XCode Tool, which I did from apple's website. 


Do I need to modify the settings in code block or do something specific with my terminal ?


Thanks much for your help!!!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Issue running after build
« Reply #1 on: January 17, 2011, 04:22:53 am »
Remove the spaces from your file/folder path.
Code
/Users/adrianhogg/Documents/C++ ALL-IN-ONE-DUMMY

Turn on Full Compiler Logging if not turned on Already.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline progr@mm1nG3niu5

  • Single posting newcomer
  • *
  • Posts: 4
Re: Issue running after build
« Reply #2 on: January 17, 2011, 08:37:55 pm »
THANKS FOR YOUR RESPONSE, REALLY APPRECIATE IT.

UNFORTUNATELY, IT DID NOT WORK.  I AM RUNNING THE DEFAULT GNU GCC COMPILER.  HOW CAN I VERIFY IF THAT IS EVEN THE RIGHT ONE OR I HAVE THE CORRECT COMPILER INSTALLED ?  I DID TRY ALL OF THEM, BUT THE OTHER 3 GAVE ME AN ERROR AND WOULDN'T EVEN EXECUTE THE PROGRAM.  AT LEAST WHEN I RUN USING GNU GCC COMPILER, IT EXECUTES, BUT I AM STILL GETTING THE ERRORS MESSAGES BELOW:

WHEN I JUST BUILD, I GET THE FOLLOWING IN MY BUILD LOG:


Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ ALL-IN-ONE-DUMMY/first project - hello/Hello /bin/Debug/Hello 
-bash: /Users/adrianhogg/Documents/C++: No such file or directory
Adrian-Hoggs-MacBook:~ adrianhogg$


WHEN I BUILD/RUN, I GET THE FOLLOWING IN MY BUILD LOG:

Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ ALL-IN-ONE-DUMMY/first project - hello/Hello /bin/Debug/Hello 
-bash: /Users/adrianhogg/Documents/C++: No such file or directory
Adrian-Hoggs-MacBook:~ adrianhogg$


I ALSO GET THE FOLLOWING IN THE COMMAND PROMPT THAT OPENS WHEN I DO BUILD/RUN:

Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello /bin/Debug/Hello 
-bash: /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello: No such file or directory
Adrian-Hoggs-MacBook:~ adrianhogg$


THANKS AGAIN FOR TAKING THE TIME TO LOOK OVER THIS.  I'M WONDERING IF UNINSTALLING AND REINSTALLING WOULD HELP.  I WILL CONTINUE TO TROUBLESHOOT IN HOPES TO NOT HAVE TO DO THAT.

Offline progr@mm1nG3niu5

  • Single posting newcomer
  • *
  • Posts: 4
Re: Issue running after build
« Reply #3 on: January 17, 2011, 08:44:28 pm »
ADDITIONAL INFO:

I JUST CLOSE CODE BLOCK AND RE-OPENED AND I AM NOW GETTING THE FOLLOWING MESSAGE WHEN I BUILD:

Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello /bin/Debug/Hello 
-bash: /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello: No such file or directory
Adrian-Hoggs-MacBook:~ adrianhogg$


WHEN I MADE THE CHANGE YOU SUGGESTED, WHICH IS TO TURN ON THE FULL COMMAND LINE, I AM GETTING THE FOLLOWING MESSAGE WHEN I BUILD:

Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello /bin/Debug/Hello 
-bash: /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello: No such file or directory


Adrian-Hoggs-MacBook:~ adrianhogg$

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Issue running after build
« Reply #4 on: January 17, 2011, 10:38:54 pm »
Do you have a problem with the CAPSLOCK key or you're intentionally using capitals? The netiquette says that writing in capitals is the same as yelling, so please don't do it!

Also activate your brain, because it is sleeping:
Quote
Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello /bin/Debug/Hello  
(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!]

Offline progr@mm1nG3niu5

  • Single posting newcomer
  • *
  • Posts: 4
Re: Issue running after build
« Reply #5 on: January 19, 2011, 12:59:02 am »
sorry, didn't mean to offend you with the caps lock...i wasn't implying anything with it.  anyway, it seems that you think i'm being disrespectful, and if you actually did read my post, i thanked you multiple times a ton for your initial response...i never once repeated myself or repeated anything I said in my initial post.  i responded with your suggested changes, and then simply pasted the errors i saw after the changes.  not sure why you would even think i was being rude.

in all, i'm just someone trying to learn, not create drama or an uncomfortable situation.


thanks anyway!

Offline pirx67

  • Multiple posting newcomer
  • *
  • Posts: 40
Re: Issue running after build
« Reply #6 on: January 21, 2011, 10:20:17 am »
WHEN I MADE THE CHANGE YOU SUGGESTED, WHICH IS TO TURN ON THE FULL COMMAND LINE, I AM GETTING THE FOLLOWING MESSAGE WHEN I BUILD:

Adrian-Hoggs-MacBook:~ adrianhogg$ /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello /bin/Debug/Hello 
-bash: /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello: No such file or directory


Adrian-Hoggs-MacBook:~ adrianhogg$

Well, I guess the following:

a) You did use "Build -> Build and Run" from the menu and not "Build -> Build" as you have written.

b) Your application is built correctly but running it fails. Wether the build is really fine we can't see because you missed to post the output from the "Build log" tab of Code::Blocks as requested.

c) Look at the error message:
Quote
-bash: /Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello: No such file or directory

The default shell interpreter of your user account ("bash") can't run the command Code::Blocks told it to do so. What command bash is looking for? It tells you:
Quote
/Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello

Why does this happen? oBFusCATed gave a hint about it in his last post (in the quote in red).

A short explanation on the probable cause. Code::Blocks builds the output binary (debug build) in a directory ./bin/Debug relative to the base directory of your project. After building it runs the new program with the full path to it. The program's name is made of "[base directory of project]/bin/Debug/[projects name]".

The full name with path of your new  seems to be:
Quote
/Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello /bin/Debug/Hello

This whole string is passed to bash to execute the program. What does bash with it? It splits the at the blank as all shell interpreters do (if you don't quote ...) and gets a program name
Quote
/Users/adrianhogg/Documents/C++ALL-IN-ONE-DUMMY/first_project-hello/Hello
with a parameter
Quote
/bin/Debug/Hello

That is not what you neither Code::Blocks wanted. Now you know why blanks in pathes and file names are evil. Because it needs extra care to make the things work.

In your case it seems that your projects base directory name contains still a blank ("Hello "). Perhaps you created your project's name "Hello " with a blank in it?

Try to make a new console project with the project wizard in a base directory without any blanks in it and with no blanks in the project's name. This should work then.

For some hints how bash evaluates a command line refer to "man bash" in a terminal window.

Hope that leads you into the right direction,
   pirx67



Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Issue running after build
« Reply #7 on: January 21, 2011, 11:39:38 am »
Do you have a problem with the CAPSLOCK key or you're intentionally using capitals?
Might be a lawyer. :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."