PDA

View Full Version : Infuriating Problem with XCode




TheFoolishFour
Apr 23, 2006, 10:55 AM
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



therevolution
Apr 23, 2006, 02:50 PM
It's probably a code issue. Let's see it.

TheFoolishFour
Apr 23, 2006, 04:46 PM
Here you go, I have created an archive with the files in for you:

45686

Regards,

TFF

therevolution
Apr 23, 2006, 05:27 PM
It seems to work okay for me. I had to make some changes to get it to compile:

#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?