Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline Shadow

  • Newbie
  • *
  • Join Date: Feb 2002
  • Posts: 7
    • Show all replies
Re: Opening libraries in c++
« on: May 03, 2003, 01:15:30 AM »
From what I can see of your code I can see you spelled IntuitionBase with at small "i" and not at capital "I".

The other error you get:
Quote
10: initialization to 'UBYTE *' from 'const char *' discards qualifiers

can be fixed with something like this:
UBYTE *p = reinterpret_cast(const_cast(o));

where "o" has been defined as: const char *o somewhere.

This first removes the const qualifier from "o" and then casts it to a UBYTE pointer

And it looks like you are missing some includes.

Try this:

#include
#include
#include

#include
using namespace std;

struct IntutionBase *intuibase = NULL;

int main()
{
  intuibase = static_cast(OpenLibrary("intuition.library", 0));

  if(intuibase != NULL)
  {
    cout << "Yeah" << endl;
    CloseLibrary(static_cast(intuibase));
  }
  else
  {
    cout << "darn it" << endl;
  }
}

This should compile with g++ or StormC4 + stlport

Offline Shadow

  • Newbie
  • *
  • Join Date: Feb 2002
  • Posts: 7
    • Show all replies
Re: Opening libraries in c++
« Reply #1 on: May 03, 2003, 09:31:00 AM »
Quote

Wrong. Never ever include clib directly. Always use , in this case .


Really?? I never heard that before. I am possitive I read somewhere allways to use clib/. But I could be wrong.

Quote

Quote
struct IntutionBase *intuibase = NULL;

That's IntuitionBase, or else he can't call any intuition functions (that's usually the reason for opening the library right?)


Ahh, I was actually very carefull not to make any mistakes, guess I missed that one.  sorry.