delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/13/04:45:57

From: libolt AT primenet DOT com (Mike McLean)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C & C++ mixed?
Date: 12 Dec 1997 22:17:03 -0700
Organization: Primenet Services for the Internet
Lines: 104
Message-ID: <34931a9a.11027695@news.primenet.com>
References: <349215bb DOT 9779905 AT news DOT primenet DOT com>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 12 Dec 1997 21:57:00 -0700, libolt AT primenet DOT com (Mike McLean)
wrote:

>I'm using DJGPP 2.01 with RHIDE 1.4.  I have a problem when compiling
>some c files with a .cpp file.  They all compile fine, but when it
>gets to linking it says in a c file that it can't find the reference
>to a function in the .cpp file.  I am also using allegro 3.0 beta
>(need to get full release)
>
>If needed I will post the code I am using.
>
>Mike.
>Lightning Bolt Software:
>-----------------------------------------------
>A new bolt of shareware EXCITEMENT!!!!
>
>Check us out at:
> -----------------------------------------
>| www.geocities.com/SiliconValley/Lab/3944 |
> -----------------------------------------

I've decided to follow up my own post and include the relevant parts
from my program (hopefully).  I hope this helps.  this is probably a
simple mistake on my part.

Mike.
-----------------------------------------------------------------------------------------------------------------------------
// part from luth.h the header file

// Prototypes for File routines

void fileSave(void);

// function in file.cpp

void fileSave(void)
{
  ofstream saveGame ("game.sav", ios::app);

  if (!saveGame)
    {
      cerr << "File could not be opened" << endl;
      exit(1);
    }
  else
    {
      saveGame << sGame.location << endl;
      saveGame << sGame.stamina << endl;
      saveGame << sGame.strength << endl;
      saveGame << sGame.dexterity << endl;
      saveGame << sGame.magic << endl;
    }
}

// function that calls fileSave

void raiknerEntrance(void)
{
  char decision[10];
  sGame.location = 111;
  clear(screen);
  graphics.mybitmap = load_pcx("raikent.pcx",graphics.pal);
  graphics.mybitmap2 = load_pcx("menubar.pcx",graphics.pal);
  blitGraph();
  textprintf(screen,font,10,412,150, "     You wake up and find
yourself at the entrance to");
  textprintf(screen,font,10,422,150, "a large town.  A sign above you
reads 'Raikner Village' ");
  textprintf(screen,font,10,432,150, "A man on horseback passes by on
the road leading inward");
  textprintf(screen,font,10,442,150, "> ");
  switch(readkey() & 0xff)
    {
      case 'f':
        raikEntranceAnim();
        insideRaikner();
        break;

      case 'b':
        raiknerRoad();
        break;
      case 's':
        fileSave();
        break;

      case 'q':
        exit(0);
        break;

      default:
        raiknerEntrance();
        break;
    }
}


Lightning Bolt Software:
-----------------------------------------------
A new bolt of shareware EXCITEMENT!!!!

Check us out at:
 -----------------------------------------
| www.geocities.com/SiliconValley/Lab/3944 |
 -----------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019