XCode Error from Debugger

Discussion in 'Mac Programming' started by freya42, Oct 26, 2011.

  1. freya42 macrumors newbie

    freya42

    Joined:
    Feb 27, 2011
    #1
    Hello everyone,

    we're just starting to learn C++ in University and I have some problems getting XCode to work.

    We got a header file "fcpp.hh" and if I put that in a directory with my program "first.cc", which looks like this:

    #include "fcpp.hh"

    int main()
    {
    return print((3+(5*8))-(16*(7+9)));
    }

    And compile and run it using the command line everything works fine.

    However, when I put the header file in the directory of a new XCode project including the code and click on "Build and Run" I get an error in the status bar which says:

    Error from Debugger: The program being debugged is not being run.

    I did not even tell XCode to build and debug, so why does this error occur?

    Any help is really appreciated!
     
  2. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #2
    What version of Xcode are you using?

    What type of Xcode project did you create? You should be creating a C++ Command Line Tool project.

    Did you add the files fcpp.hh and first.cc to the project? Putting the files in the same directory as your project doesn't add them to the project. You must add them to your project for Xcode to be able to build the project. When you add first.cc to the project, you must remove the main.cpp Xcode supplies for C++ projects because both files define a main() function, which will cause problems when you build the project.

    If you create a new C++ Tool project and choose Build and Run, do you get any errors? If not, you would be better off using the main.cpp file that Xcode supplies instead of your first.cc file.
     
  3. freya42 thread starter macrumors newbie

    freya42

    Joined:
    Feb 27, 2011
    #3
    I'm using XCode Version 3.2.6. I also created a c++ command line tool project.
    I get the same result when I just copy the content of first.cc into my main.cpp.
    I thought if I put the fcpp.hh header file into the directory itself I wouldn't need to specify it in the (user) header search paths.
    I tried to include the header file using "Project > Add to Project..." as well, but that doesn't help.
    I think it's probably not that XCode can't find the header file, because I had it in a different directory before and not specified the paths and XCode told me it couldn't find it. So now it's not complaining about that anymore I think it can find the file.

    It just keeps showing that error "Error from Debugger: The program being debugged is not being run." when I try to run it.

    When I do the build seperately before I run it, XCode tells me "Build succeeded".
     
  4. szymczyk macrumors regular

    Joined:
    Mar 5, 2006
    #4
    Choosing Run > Console opens the debugger console. The console may display additional information about the error.

    If you create a brand new project and choose Build and Run, do you get any errors?
     

Share This Page