Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

TheFoolishFour

macrumors newbie
Original poster
Apr 23, 2006
2
0
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

macrumors 6502
May 12, 2003
468
0
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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.