Author Topic: Mac Codeblocks Running  (Read 292 times)

Offline ostrich

  • Single posting newcomer
  • *
  • Posts: 5
Mac Codeblocks Running
« on: July 07, 2017, 01:21:48 pm »
I made my code and built it but when it opens in terminal, the following appears:
Last login: Fri Jul  7 20:38:36 on ttys000
/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/(MY USER)/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate
mbastudent122:~ (MY USER)$ /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/(MY USER)/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate

Process returned 0 (0x0)   execution time : 0.027 s
Press ENTER to continue.

I am running Mac OS Sierra and Codeblocks 13.12.
I used to be fine to test my code so what happened?

*(MY USER) is me but I changed it to protect my privacy

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1370
Re: Mac Codeblocks Running
« Reply #1 on: July 09, 2017, 10:47:44 pm »
I am no mac user, so i can only try to help you...

What do you mean by
Quote
when it opens in terminal, the following appears

This looks as your program runs fine, but you do not print anything on the console?
Quote
Process returned 0 (0x0)   execution time : 0.027 s
Press ENTER to continue.

Offline ostrich

  • Single posting newcomer
  • *
  • Posts: 5
Re: Mac Codeblocks Running
« Reply #2 on: July 10, 2017, 09:24:38 am »
When I run the code, the code may not have any errors but I can't test it to see if it runs the way I'd like it to. It states that the location of the file is a directory but I don't actually get to use it in the way I'd like to.

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1370
Re: Mac Codeblocks Running
« Reply #3 on: July 11, 2017, 11:55:03 pm »
does the program run if you start it directly from the directory?
Does the path contains any whitespaces?

In your example in the first post i don't see any error message... The program does run fin as far as i can tell...

Can you write the exact steps you do, because from your text i still can not figure out what is going wrong...
For example:
1) I wrote a program (with this code: ....)
2) I hit compile, there are 0 errors
3) I hit run. A blank window pops up with the message .... in it
ecc

Offline ostrich

  • Single posting newcomer
  • *
  • Posts: 5
Re: Mac Codeblocks Running
« Reply #4 on: July 15, 2017, 11:20:58 am »
When I run the program from: /Macintosh HD/Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug it produces this:
Last login: Sat Jul 15 18:12:06 on ttys002
mbastudent122:~ MYNAME$ /Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate ; exit;
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

The path only contains whitespace in the volume name but it's been like that since I got the macbook and it used to work.

Steps:
1. I wrote a program with:
#include <iostream>

using namespace std;

void calculator()
{
    float num1, num2, log;
    char Operator, answer;
    cout << "Input an equation (e.g. 1+2) using operators +, -, * or /" << endl;
    cin >> num1 >> Operator >> num2;
    switch (Operator) {
case '+':
    log = num1 + num2;
    break;
case '-':
    log = num1 - num2;
    break;
case '*':
    log = num1 * num2;
    break;
case '/':
    log = num1 / num2;
    break;
    }
    cout << log << endl;
    cout << "--------------------------------------------------------------------------------------" << endl;
    cout << "Would you like to continue? (y or n)" << endl;
    cin >> answer;
    if (answer == 'y')
    do {

    float num1, num2, log;
    char Operator, answer;
    cout << "Input an equation (e.g. 1+2) using operators +, -, * or /" << endl;
    cin >> num1 >> Operator >> num2;
    switch (Operator) {
case '+':
    log = num1 + num2;
    break;
case '-':
    log = num1 - num2;
    break;
case '*':
    log = num1 * num2;
    break;
case '/':
    log = num1 / num2;
    break;
    }
    cout << log << endl;
    cout << "--------------------------------------------------------------------------------------" << endl;
    cout << "Would you like to continue? (y or n)" << endl;
    cin >> answer;
    }
    while (answer == 'y');
    cout << "Understandable, have a great day!" << endl;
}

int main()
{
    calculator;
    return 0;
}

2. I hit compile - No errors

3. I hit run and a terminal window came up showing:
Last login: Sat Jul 15 18:12:37 on ttys002
/private/var/folders/f2/qjwg6b011tdbxr47v8g3m3bnr_y7jw/T/AppTranslocation/C55E393A-AFDF-44DE-B4E0-5E86D812235A/d/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate
mbastudent122:~ MYNAME$ /private/var/folders/f2/qjwg6b011tdbxr47v8g3m3bnr_y7jw/T/AppTranslocation/C55E393A-AFDF-44DE-B4E0-5E86D812235A/d/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/MYNAME/Desktop/Stuff/Coding/Codeblocks/Calculate/bin/Debug/Calculate

Process returned 0 (0x0)   execution time : 0.035 s
Press ENTER to continue.

Since my last post, it has actually changed and I have no idea why. Don't ask me because I don't have an answer.





Offline stahta01

  • Lives here!
  • ****
  • Posts: 5835
    • My Best Post
Re: Mac Codeblocks Running
« Reply #5 on: July 15, 2017, 10:02:55 pm »
Please read the rules for this site; this site does NOT teach programming!
http://forums.codeblocks.org/index.php/topic,9996.0.html

This is NOT how to call a function!!!
Code: [Select]
calculator;
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ostrich

  • Single posting newcomer
  • *
  • Posts: 5
Re: Mac Codeblocks Running
« Reply #6 on: July 17, 2017, 11:00:37 am »
Thank you so much stahta01!
I'm sorry about the mistake in the code but that fixed my problem.
I'll try extra hard to prrof read and make sure I have the code all correct next time.