Jump to content



Photo
- - - - -

Using Class


  • Please log in to reply
4 replies to this topic

#1 paul_brassington

paul_brassington

    Newbie

  • Members
  • Pip
  • 25 posts

  • Calculators:
    fx-9860g II SD

Posted 17 March 2013 - 12:08 PM

Hi Guys,

I've just begun putting C++ code into my project and it does not compile.

I've simplified it as much as possible so you nice guys could help me without having to read too much code.

#include "fxlib.h"
#include "Topic.h"

int AddIn_main(int isAppli, unsigned short OptionNum){

unsigned int key;
Topic topic;
locate(2, 5);
Print((unsigned char*) "What next");
while(1){
GetKey(&key);
}
}

#pragma section _BR_Size
unsigned long BR_Size;
#pragma section


#pragma section _TOP

int InitializeSystem(int isAppli, unsigned short OptionNum){
return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}

#pragma section

Next the class (Topic.h)

class Topic {

public:
int instruction_no;
protected:
};

And Topic.c

#include "Topic.h"

Compiler error:

C:\Users\Paul Brassington\Documents\CASIO\fx-9860G SDK\input\input\Topic.h(1) : C2500 (E) Illegal token "Topic"
C:\Users\Paul Brassington\Documents\CASIO\fx-9860G SDK\input\input\Topic.h(1) : C2500 (E) Illegal token "{"
C:\Users\Paul Brassington\Documents\CASIO\fx-9860G SDK\input\input\input.c(7) : C2225 (E) Undeclared name "Topic"
C:\Users\Paul Brassington\Documents\CASIO\fx-9860G SDK\input\input\input.c(7) : C2500 (E) Illegal token "topic"
C:\Users\Paul Brassington\Documents\CASIO\fx-9860G SDK\input\input\input.c(7) : C2225 (E) Undeclared name "topic"

It must be a simple mistake as the SDK does say it can compile C++ code.

Thanks in anticipation

Paul

#2 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 17 March 2013 - 03:08 PM

shouldn't the files be *.cpp or *.hpp instead of *.c and *.h?

#3 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 17 March 2013 - 04:36 PM

And when you renamed the files, don't forget to put the "casiostuff" into 'extern C'-sections.

#4 paul_brassington

paul_brassington

    Newbie

  • Members
  • Pip
  • 25 posts

  • Calculators:
    fx-9860g II SD

Posted 17 March 2013 - 04:45 PM

Hi Casimo,

Could you please expand upon what to put into the class files as this is all new to me. A simple example would mean a thousand blessing to you.

Warm Regards

Paul

#5 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 17 March 2013 - 04:52 PM

I never used C++ before :P
You should look for "evasion survival", for example, on planete casio (French). There could be a tutorial on casiopeia, but I'm not sure.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users