Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
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, 11:56 AM   #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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
10.6 script on 10.4 machine doesn't work - "class alst" error?? steevg Mac Programming 1 Jan 7, 2011 06:52 AM
Xcode class inheritance error in C++ macuser571 Mac Programming 2 Dec 3, 2009 01:12 PM


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

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

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC