Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old Jan 31, 2012, 12:56 PM   #1
datscha
macrumors newbie
 
Join Date: Jan 2012
Class redefinition error

Hi everyone,

First of all I'm pretty sure I'm not the first one to get this error but every similar thread I found either didn't get me an answer or wasn't relevant enough.
So, why not try creating my own thread?

In some obscure Financial Engineering class, I have to use different math transforms (some using fft).
In order to make it work I had to create two classes: Complex and Options.

The first time I ran my code, in order to test the methods within the classes, everything worked fine. But now, everytime I build, I get a Semantic Issue - Redefinition of 'Complex' // 'Options'.
Then XCode points out the fact I included the header files in other .cpp // .h files and they tell me the previous definitions are there.
I really don't get what I should do!

BTW, I'm under Snow Leopard and using XCode 4.0.1

Below my header for one of my classes, and I'm #includ-ing it in several other files.

Thanks!

Code:
class Complex {
public:
    Complex(float realpart=0, float imaginarypart=0);
    Complex Add(const Complex &c) const;
    float GetReal() const;
    float GetImaginary() const;
    void SetReal(float r);
    void SetImaginary(float i);
    void fft(double* x);
    Complex Multiply(const Complex &a) const;
    Complex power(float p) const;
    float norm() const;
    Complex coshC() const;
    Complex sinhC() const;
    Complex cothC() const;
    float arg() const;
    Complex expComplex() const;
    void outprint() const;
private:
    float real;
    float imaginary;
};
datscha is offline   0 Reply With Quote

 
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Assigning new instance of a class to an object that had an instance of the class moonman239 iPhone/iPad Programming 3 Oct 11, 2013 01:58 PM
The Java class file "xxx.class" could not be launched. piratemacfan Mac Applications and Mac App Store 1 Aug 31, 2013 04:24 PM
The Java class file "PopSampleApplet.class" could not be launched. piratemacfan OS X 10.8 Mountain Lion 0 Aug 30, 2013 04:03 PM
Referencing a child class in a parent class, good or bad? SAIRUS iPhone/iPad Programming 11 Aug 28, 2013 12:59 PM
Difference between Public class and private class. zijianz iPhone/iPad Programming 4 Jun 29, 2012 10:29 PM

Forum Jump

All times are GMT -5. The time now is 07:28 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC