i386/71709: c++ compiler forgets global varibles

kristina joner weasal at hq.dyns.cx
Mon Sep 13 12:30:30 PDT 2004


>Number:         71709
>Category:       i386
>Synopsis:       c++ compiler forgets global varibles
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 13 19:30:29 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     kristina joner
>Release:        FreeBSD 5.2.1 RELEASE 9
>Organization:
private
>Environment:
c++ -o mplayer.o -c MPlayer.cpp -I/usr/local/include
MPlayer.cpp: In member function `void MPlayer::makeloop()':
MPlayer.cpp:31: error: `wrap' undeclared (first use this function)
MPlayer.cpp:31: error: (Each undeclared identifier is reported only once for
   each function it appears in.)

**THE SOURCE FOR MPlayer.cpp**

#include <mikmod.h>
#include "MPlayer.h"

MODULE* currentmodule;


void MPlayer::makeloop()
{
 wrap=1;
}
void MPlayer::makeunloop()
{
 wrap=0;
}

void MPlayer::update()
{
 if(Player_Active())
 {
  Update_MikMod();
 }
}

void MPlayer::musicpause()
{
 if(Player_Active())
 {Player_Togglepause();}
}                           

void MPlayer::musicstop()
{
 if(Player_Active())
 {
  Player_Stop();
 }

}

void MPlayer::musicgo()
{
 if(Player_Active())
 {
  if(Player_Paused())
  {
   Player_Togglepause();
  }
 }
 else
 {
  if(currentmodule){
  Player_Start(currentmodule);
  }
 }
void MPlayer::loadmusic(char* file)
{
 if(currentmodule)
 {
  if(Player_Active())
  { Player_Stop();}
  Player_Free(currentmodule);
  currentmodule=0;
 }

 currentmodule=Player_Load(file,128,0);
}


MPlayer::MPlayer()
{
 RegisterAllDrivers();
 RegisterAllLoaders();
 MikMod_Init("");
 currentmodule=0;
}

MPlayer::~MPlayer()
{
   if(Player_Active())
 {

  Player_Stop();
 }

 if(currentmodule){Player_Free(currentmodule);currentmodule=0;}

 MikMod_Exit();
}
                       
                         

>Description:
it compiled the other code just fine
it is running this from a Makefile

it regonize's MODULE* objects but not the wrap varible or the
functions defined inside mikmod.h

it seems to me that when it checks for object varibles and methods that
it forgets to check for anyother varibles and methods out side the object.


>How-To-Repeat:
make the source.
compile like this
c++ -o mplayer.o -c MPlayer.cpp -I/usr/local/include

"-I/usr/local/include" is where the mikmod.h file resides.      
>Fix:
i can only guess to check if its looking for global varibles along with
the local varibles of the object and there methods      
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list