1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Infuriating Problem with XCode

Discussion in 'Mac Programming' started by TheFoolishFour, Apr 23, 2006.

  1. macrumors newbie

    #1
    Hi,

    I am pretty new to using Xcode, and I have used some C++ before. The problem that I am having is that code which used to compile correctly is not doing so anymore.

    The problem is as follows:
    I create a new C++ tool within Xcode. I then proceed to write a new set of functions using a header file and a cpp file. However, upon compiling Xcode, it decides to point the first variable of the function to a random bit in the memory. I can see this is happening when I debug in Xcode

    I.e. when I write Foo(100.0,100.0,0.0,0.0,0.2,0.0) then what in fact is calculated is Foo(XXXXX,100.0,0.0,0.0,0.2,0.0), where XXXXX is a seemingly random variable.

    Have I set up Xcode wrongly or is there something I can do to fix the problem (i.e. is it a code based issue??). If it makes it easier, I can post my code.

    Regards,
    TFF
     
  2. macrumors 6502

    #2
    It's probably a code issue. Let's see it.
     
  3. macrumors newbie

    #3
  4. macrumors 6502

    #4
    It seems to work okay for me. I had to make some changes to get it to compile:
    Code:
    #include <cmath> // okay because it's a standard library
    #include <analyticsBS.h> // wrong because it's not a standard library, but a local file
    #include "analyticsBS.h" // correct
    
    Once I fixed those, everything looked normal. Can you walk me through what exactly you're doing and how you're checking the values?

    By the way, I'm not doing this through Xcode, but simply through g++ on the command line. Have you tried compiling and running it there?
     

Share This Page