From nobody@FreeBSD.org  Mon Sep 13 19:29:16 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 68DAF16A4D0
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Sep 2004 19:29:16 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 460F243D39
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Sep 2004 19:29:16 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i8DJTF9M088432
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 13 Sep 2004 19:29:15 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.11/8.12.11/Submit) id i8DJTFJ1088430;
	Mon, 13 Sep 2004 19:29:15 GMT
	(envelope-from nobody)
Message-Id: <200409131929.i8DJTFJ1088430@www.freebsd.org>
Date: Mon, 13 Sep 2004 19:29:15 GMT
From: kristina joner <weasal@hq.dyns.cx>
To: freebsd-gnats-submit@FreeBSD.org
Subject: c++ compiler forgets global varibles
X-Send-Pr-Version: www-2.3

>Number:         71709
>Category:       bin
>Synopsis:       c++ compiler forgets global varibles
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 13 19:30:29 GMT 2004
>Closed-Date:    Mon Sep 27 12:55:45 GMT 2004
>Last-Modified:  Mon Sep 27 12:55:45 GMT 2004
>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:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Sep 16 03:50:20 GMT 2004 
Responsible-Changed-Why:  
This is not i386-specific. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71709 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Mon Sep 27 12:55:43 GMT 2004 
State-Changed-Why:  
Not a compiler bug; wrap simply isn't a global variable. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71709 
>Unformatted:
