MaxMod2. Can't compile.

BlitzMax Forums/BlitzMax Programming/MaxMod2. Can't compile.

Richard Betson(Posted 2010) [#1]
I can not get this mod to compile. Anyone use this mod? Is there an alternative mod I could use?

It can be found here:
http://code.google.com/p/maxmod/

Here is a Snippet of the compile errors I get:

Compiling:music.cpp
Compiling:file.cpp
C:/BlitzMax141/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function 'vi
rtual void cfile::Close()':
C:/BlitzMax141/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:6:40: error: 'fclose' w
as not declared in this scope
C:/BlitzMax141/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function 'vi
rtual int cfile::Eof()':


Shortwind(Posted 2010) [#2]
Don't know if this helps but I download the 1.07 version from the website, stuck the maxmod2.mod directory in:

c:\blitzmax\mod

entered blitzmax IDE and then did a build modules. No errors here.

Windows blitzmax 141, current mingw.

(Your not loading the maxmod2.bmx file and trying to compile that are you?)

Laters,
:D

Last edited 2010


shinkiro1(Posted 2010) [#3]
Hade the same problem today

Open file.cpp and write the following on top in the first line
#include <stdio.h>

Then recompile and everything should be fine ;D


Richard Betson(Posted 2010) [#4]
@Espada,

Cool.. That got it to compile with no errors.

But, I can not get the examples to compile. :( Have you had any luck compiling the examples?

Thanks!


shinkiro1(Posted 2010) [#5]
Yes, but only the player example. The other includes some mods which is not there.

Import maxmod2.rtaudio
Import maxmod2.ogg

SetAudioStreamDriver("Maxmod rtaudio")

Graphics 400,300,0

ms = MilliSecs()
Local bank:TBank = LoadBank("music.ogg")
Print MilliSecs()-ms
Local music:TChannel = PlayMusic(bank)

WaitKey()
End


Try this example (you have to put a .ogg file in your folder called music.ogg)

On my machine the driver for audio is then automatically set to the maxmode rtaudio driver.
Maybe you have to set it manually through
SetAudioDriver

For me thats
SetAudioDriver( AudioDrivers()[2] )



Richard Betson(Posted 2010) [#6]
I will give it a try. :)

I emailed the author about these issues but so far no reply.


GfK(Posted 2010) [#7]
This is all weird. I've had Maxmod2 v1.07 installed for ages and not had any of these problems under Windows or MacOS.


Amon(Posted 2010) [#8]
I can't get it to work either. I'm using the latest version of max and I have the mod installed properly, built and the module documented.

It keeps complaining that it can't find the interface for maxmod2. I've noticed some case differences between module names its looking for and what the actual ide picks up.

My Mod folder is like this.

BlitzMax/mod/maxmod2.mod/allthefiles.


xlsior(Posted 2010) [#9]
it should be: BlitzMax\mod\maxmod2.mod\maxmod2.mod\allthefiles

(At least, this is what my mod/maxmod2.mod folder contains:
  <DIR>          dumb.mod
  <DIR>          examples
  <DIR>          flac.mod
  <DIR>          maxmod2.mod
  <DIR>          ogg.mod
  <DIR>          rtaudio.mod
  <DIR>          wav.mod


Last edited 2010


GfK(Posted 2010) [#10]
I've had a right old ballache of a job reinstalling MinGW in the last couple of days - finally cracked it last night and today I noticed that MaxMod2 will no longer compile.

Found another thread on here which says to edit file C:\BlitzMax\mod\maxmod2.mod\maxmod2.mod\code\file.cpp and add Include <stdio.h> at the first line (above #include "maxmod2.h").

Rebuilt modules and everything is working fine again.


seriouslee(Posted 2010) [#11]
Many thanks for this post -- had the same problem when I updated MinGW. Adding #include <stdio.h> worked with no problems.


Richard Betson(Posted 2010) [#12]
I'll give this a go and report. Hope it works. :)


steph(Posted 2010) [#13]
Edit: nevermind. Seems like there is a problem using maxmod2 with the current version of MinGW. I deinstalled Blitzmax, deinstalled my MinGW installation, made a clean reinstall of blitzmax, maxmod2 and used the version of MinGW linked in the sticky. Now everything seems to work as it should.

Compiling works fine after adding the include under windows as well as linux, but while i am able to play music from within a linux-build (but have some problems loading files from subfolders) I get a huge amount of undefined reference error messages when trying to compilethe same blitzmax application under windows during the linking process like
C:/BlitzMax/mod/maxmod2.mod/rtaudio.mod/rtaudio.release.win32.x86.a
(rtaudiodriver.cpp.release.win32.x86.o):rtaudiodriver.cpp:(.text+0xf3):
undefined reference to `_Unwind_Resume'


and

C:/BlitzMax/mod/maxmod2.mod/rtaudio.mod/rtaudio.release.win32.x86.a
(RtAudioOS.cpp.release.win32.x86.o):RtAudioOS.cpp:(.text+0x3533):
undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'

.

Last edited 2010

Last edited 2010


REDi(Posted 2010) [#14]
Hi steph

It seems your version of MaxMod2 was compiled with a different version of MinGW, AFAIK _Unwind_Resume is a GCC 4 thing, could you try rebuilding all modules again and see if that makes a difference.

It looks like I've got some catching up to do with maxmod, it's been a bit neglected over the last year, but I should get more spare time over christmas.

Last edited 2010


steph(Posted 2010) [#15]
Do you mean choosing "Rebuild all Modules" under "Program" with the actual version of MinGW installed? I'll try that tomorrow as I am currently at my girl friend's home who has only a vista machine and I am too stupid to get MinGW (actual version, not the one in the sticky above) running under that (not) operating system.

Last edited 2010


Richard Betson(Posted 2010) [#16]
@REDi
"but I should get more spare time over christmas"
Yay, cool to see. Works for me. :)


Russell(Posted 2011) [#17]
(Bump)

Hello, REDi! Hope everything is well with you.

So, I now have a dual boot (actually, triple boot: Windows XP, Windows 7 x64 and Ubuntu Linux) and have been trying to get maxmod2 to compile under Ubuntu. I get the following error message:
Compile Error

error: 'fclose' was not declared in this scope

BlitzMax IDE highlights this line from maxmod2.mod/code/file.cpp:
void    cfile::Close()                {fclose(pFile);}

and the output window shows this un-helpful list:
Building Modules
Compiling:file.cpp
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual void cfile::Close()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:6: error: &#128;fclose&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual int cfile::Eof()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:7: error: &#128;feof&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual long int cfile::Position()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:9: error: &#128;ftell&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual long int cfile::Seek(long int)&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:10: error: &#128;ftell&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual long int cfile::SeekFrom(long int, int)&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:11: error: &#128;fseek&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:11: error: &#128;ftell&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual int cfile::Flush()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:12: error: &#128;fflush&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual long int cfile::Read(void*, size_t)&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:13: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual char cfile::ReadByte()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:14: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual short int cfile::ReadShort()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:15: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual int cfile::ReadInt()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:25: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual long int cfile::ReadLong()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:26: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual float cfile::ReadFloat()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:27: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual double cfile::ReadDouble()&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:28: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In member function &#128;virtual std::string cfile::ReadString(int)&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:29: error: &#128;fread&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp: In function &#128;IMaxModStream* MaxMod_CreateStream(char*)&#128;:
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:99: error: &#128;fopen&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:103: error: &#128;fseek&#128; was not declared in this scope
/home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp:104: error: &#128;ftell&#128; was not declared in this scope
Build Error: failed to compile /home/russell/BlitzMax/mod/maxmod2.mod/maxmod2.mod/code/file.cpp
Process complete

Any ideas? (I'm using Ubuntu 10.10, BlitzMax 1.41 (with Brucey's bmk_ng) and gcc 4.4.5)

Russell


Russell(Posted 2011) [#18]
I see a lot of 'config' and 'make' files in there: Are there extra steps I need to perform to get it working (install something in the /lib or /usr/lib directory, execute one of the script files, etc), or does bmk already know what to do when I Build Modules?

I'm pretty sure I got this working fine under Windows XP/7 and MacOSX 10.6.2 (under VirtualBox, no less), so I think I'm maybe missing a step or something similar for Ubuntu.

Russell


Russell(Posted 2011) [#19]
It looks like the file 'new.h' is included in the 5.1.3 minGW, but NOT in the newest version. That's why it compiles with the old version, but not with the new... (Those minGW people are such great practical jokers by not including it, don't you think? ;)).

So, copy the 'new.h' file from the "old" version of minGW (You'll find it in the "..\MinGW\include\c++\3.4.2\backward" folder of the 5.1.3 installation of minGW) to C:\MinGW\include of the latest minGW installation and all should be well.

Hope this helps someone.

Russell

p.s. If you can't find the new.h file, or don't want to unzip/install the 5.1.3 version of minGW just for this one file, here it is. Just save it as a plain text file called 'new.h' and put it in your C:\MinGW\include folder:

// -*- C++ -*- forwarding header.
// Copyright (C) 2000 Free Software Foundation

// This file is part of GCC.
//
// GCC is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// GCC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GCC; see the file COPYING. If not, write to
// the Free Software Foundation, 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _BACKWARD_NEW_H
#define _BACKWARD_NEW_H 1

#include "backward_warning.h"
#include <new>

using std::bad_alloc;
using std::nothrow_t;
using std::nothrow;
using std::new_handler;
using std::set_new_handler;

#endif




Brucey(Posted 2011) [#20]
Changing <new.h> to <new> should fix it...