Welcome, Guest. Please login or register.

Author Topic: Opening libraries in c++  (Read 3486 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DeslerTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 242
    • Show all replies
Opening libraries in c++
« on: May 02, 2003, 12:23:46 PM »
Recently I have thrown myself at the mercy of programming c++ on the amiga.
However lately I have come across this problem that I simply cannot open and use ANY library  and I cannot find any examples on the net how to do it.

Is there anyone outthere able to do this that would be so kind to give an example in c++. It would be much appreciated :-)

Im using gcc and my main purpose is to open intuition and use for opening a window.
(Uhh I hope this is not a real dumb question  :-) )
The horse is a fierce predatory animal!!!
 

Offline DeslerTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 242
    • Show all replies
Re: Opening libraries in c++
« Reply #1 on: May 02, 2003, 08:03:24 PM »
No if only it was that easy. This is my problem excactly. It works fine under c but when changing to c++ you get different error messages.
I tried this piece of code:

#include

struct intuitionBase *IntuitionBase;
IntuitionBase = (struct IntuitionBase*)OpenLibrary("intuition.library", 39);

if (IntuitionBase) CloseLibrary(IntuitionBase);

void main()
{
}


and I got

ANSI C++ forbids declaration `IntuitionBase' with no type
4: conflicting types for `int IntuitionBase'
3: previous declaration as `struct intuitionBase * IntuitionBase'
4: implicit declaration of function `int OpenLibrary(...)'
4: initialization to `int' from `IntuitionBase *' lacks a cast
6: parse error before `if'

 :-?
Is there anyone who can tell me how to make this work
The horse is a fierce predatory animal!!!
 

Offline DeslerTopic starter

  • Full Member
  • ***
  • Join Date: Apr 2002
  • Posts: 242
    • Show all replies
Re: Opening libraries in c++
« Reply #2 on: May 02, 2003, 10:42:16 PM »
Thanks guys. I really appreciate your help. But its still not there. When I run the code I got from Piru Ill get this errorcode
10: initialization to `UBYTE *' from `const char *' discards qualifiers    

I know this is really rookie problems, but I really would like to know what I do wrong  :-(
The horse is a fierce predatory animal!!!