Jump to content



Photo
- - - - -

C Or C++


  • Please log in to reply
11 replies to this topic

#1 blubberbert

blubberbert

    Newbie

  • Members
  • Pip
  • 8 posts
  • Gender:Male

  • Calculators:
    FX-9860G

Posted 22 June 2009 - 07:08 PM

i know C++ and C (or better: i know what you cant do in C, but can do in C++)
ive already tried writing addins in C but im used to C++ (wrote some progs for PC)
ive heard you can write addins for the fx9860g in C or C++ and now i want to know:
1. Is it true?? :blink:
2.If yes what features of C++ can you use? :unsure:
3.What do you use, what do you admit?

#2 E_net4

E_net4

    Casio Freak

  • Members
  • PipPipPipPip
  • 189 posts
  • Gender:Male
  • Location:Output("Error: Coord type not specified");
  • Interests:Programming 'n' stuff...

  • Calculators:
    CASIO fx 9860G SD

Posted 22 June 2009 - 08:19 PM

You can only use C for making Addins, and not C++.
If you want to know more about making Addins for your calculator, please proceed to the Casio Educational online service: https://edu.casio.co...wnload_service/
From here you can download the SDK and the manuals for it.

#3 Andreas B

Andreas B

    Casio Freak

  • Members
  • PipPipPipPip
  • 160 posts
  • Gender:Male
  • Location:Norway

  • Calculators:
    fx-9860G SD

Posted 23 June 2009 - 01:58 AM

For C++: Edit your addin.mak file; change "-lang=c" to "-lang=cpp" and wrap the entire file with: extern "C" { codegoeshere }
Building in the SDK regenerates the addin.mak, so build by running the .bat file in your project instead.

It is like C with classes. I like C.

#4 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 23 June 2009 - 04:36 AM

Thanks for the instructions, Andreas B .. I thought all you had to do was rename the source file to .cpp :)

#5 blubberbert

blubberbert

    Newbie

  • Members
  • Pip
  • 8 posts
  • Gender:Male

  • Calculators:
    FX-9860G

Posted 23 June 2009 - 07:14 AM

thx for the fast replies...(are you guys nocturnal?) :greengrin:
ive tried your solution andreas B but i found out that "-lang=c" is automaticly changed to "-lang=cpp" if a .cpp-file is the source...
i can still run the whole sdk (not the .bat file only) but i dont like that, anyway :P
but the extern "C"{} - stuff is true <_<
maybe someone has a better solution?
but anyway, what features of C++ can i use(what about templates, classes, inheritance... and what about the standard-libaries :blink: )

#6 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 23 June 2009 - 09:12 AM

Lol its not night time over here :P and you're welcome :D

So you have to use extern "C" {}.. ahh .. :rolleyes:

AFAIK ... I don't know :P about what features you can use.. I don't really know what templates are, lol! Guess I'll need to brush up on my C++ before I write a nice app for the fx-9860.. :)

#7 blubberbert

blubberbert

    Newbie

  • Members
  • Pip
  • 8 posts
  • Gender:Male

  • Calculators:
    FX-9860G

Posted 23 June 2009 - 09:29 AM

ive just tried to devclare a simple template class:
[codebox]extern "C"
{
#include "fxlib.h"

template<class T>
class PAIR
{
public:
T first;
T second;
};
...[/codebox]
but the compiler returns an error:
This declaration may not have extern "C" linkage
i guess this is because of the extern "C"{} - solution... is there maybe another way?
pls help

#8 Martin

Martin

    Casio Freak

  • Members
  • PipPipPipPip
  • 121 posts
  • Gender:Male
  • Location:Praha
  • Interests:asm on cfx9850

  • Calculators:
    fx82l
    fx7700GB
    cfx9850G
    TI92
    fx9860G SD
    Rheinmetall KEL IIc
    H. W. Ebmeyer - Tarema
    fx cg20

Posted 23 June 2009 - 09:34 AM

ive just tried to devclare a simple template class:...pls help

Try to include headers before the extern keyword:

#include "fxlib.h"
extern "C"
{
template<class T>
...

#9 blubberbert

blubberbert

    Newbie

  • Members
  • Pip
  • 8 posts
  • Gender:Male

  • Calculators:
    FX-9860G

Posted 23 June 2009 - 09:37 AM

i forgot to tell you that the error is about the "template<class T>" line... <_<

#10 Martin

Martin

    Casio Freak

  • Members
  • PipPipPipPip
  • 121 posts
  • Gender:Male
  • Location:Praha
  • Interests:asm on cfx9850

  • Calculators:
    fx82l
    fx7700GB
    cfx9850G
    TI92
    fx9860G SD
    Rheinmetall KEL IIc
    H. W. Ebmeyer - Tarema
    fx cg20

Posted 23 June 2009 - 11:39 AM

i forgot to tell you that the error is about the "template<class T>" line... <_<

Oh it's the opposite way:
This should work (I hope):
extern "C"
{
#include "fxlib.h"
}

template<class T>
...

so only the includes are in extern "C" block

#11 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 24 June 2009 - 09:59 AM

Smart answer... templates are from C++ :)

#12 blubberbert

blubberbert

    Newbie

  • Members
  • Pip
  • 8 posts
  • Gender:Male

  • Calculators:
    FX-9860G

Posted 26 June 2009 - 11:33 AM

yeah i found that out now, too... :rolleyes:
unfortunately the addin_main()-function needs extern "C", so i have to use
[codebox]
extern "C"
{
// includes
}
//C++ stuff + a fake main()-function if i want to use c++ in the main function
extern "C"
{
addin_main()
{
fake main();
}
}[/codebox]
but i think thats worth it ;)
thx for your help :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users