User forums > Help

Mac Codeblocks Running

(1/2) > >>

ostrich:
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

BlueHazzard:
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
--- End quote ---

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.
--- End quote ---

ostrich:
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.

BlueHazzard:
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

ostrich:
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.




Navigation

[0] Message Index

[#] Next page

Go to full version