Compiling errors while using amalgamated JUCE


#1

Hello,

I’m using codeblocks+mingw on WinXP. I’m not sure if I’m using the amalgamated JUCE in a proper way. I simply created a project with a main.cpp and included juce_amalgamated.cpp and .h into the project. In the main.cpp I made some JUCE function calls. However I got some errors (14 errors exactly), I guess they are caused by inappropriate macro definitions or header inclusion.

errors:

F:\Downloads\juce-svn\juce_amalgamated.cpp:222109: error: `Byte' was not declared in this scope F:\Downloads\juce-svn\juce_amalgamated.cpp:222109: error: expected primary-expression before ')' token F:\Downloads\juce-svn\juce_amalgamated.cpp:222109: warning: unused variable 'Byte' F:\Downloads\juce-svn\juce_amalgamated.cpp: In function `bool juce::juce_setFileReadOnly(const juce::String&, bool)': F:\Downloads\juce-svn\juce_amalgamated.cpp:229699: error: declaration of `bool juce::juce_setFileReadOnly(const juce::String&, bool)' throws different exceptions F:\Downloads\juce-svn\juce_amalgamated.cpp:4548: error: than previous declaration `bool juce::juce_setFileReadOnly(const juce::String&, bool) throw ()' F:\Downloads\juce-svn\juce_amalgamated.cpp:239480:21: comutil.h: No such file or directory F:\Downloads\juce-svn\juce_amalgamated.cpp:239541: error: `_variant_t' was not declared in this scope F:\Downloads\juce-svn\juce_amalgamated.cpp:239541: error: expected `;' before "flags" F:\Downloads\juce-svn\juce_amalgamated.cpp:239544: error: `headersVar' was not declared in this scope F:\Downloads\juce-svn\juce_amalgamated.cpp:239544: warning: unused variable 'headersVar' F:\Downloads\juce-svn\juce_amalgamated.cpp:239566: error: `postDataVar' was not declared in this scope F:\Downloads\juce-svn\juce_amalgamated.cpp:239566: warning: unused variable 'postDataVar' F:\Downloads\juce-svn\juce_amalgamated.h:22454: error: `juce::Component::ComponentFlags juce::Component::<anonymous union>::flags' is private F:\Downloads\juce-svn\juce_amalgamated.cpp:239572: error: within this context F:\Downloads\juce-svn\juce_amalgamated.cpp:239572: error: `frame' was not declared in this scope F:\Downloads\juce-svn\juce_amalgamated.cpp:239573: error: `postDataVar' was not declared in this scope F:\Downloads\juce-svn\juce_amalgamated.cpp:239573: error: `headersVar' was not declared in this scope

Is the amalgamated version fully tested on different platforms?


#2

No - trying to make sure it compiles on the ropey old codeblocks compiler is just a PITA, so I’m not going to guarantee anything about that platform. If you’re using the amalgamated version, I’d stick to MSVC


#3

OK. 8) You are absolutely the leader.

But codeblocks can work in principle with any compiler. And gcc keeps going fast as a modern compiler. However, we can say MSVC is a quite ‘special’ one. :lol: I don’t mind to use it (in fact I have the ropey VC6 installed), just because I have no more space on my harddisk to install it.

I can compile JUCE as a library without problem. But I cannot use the amalgamated version. I also tried to use the juce_amalgamated_template version and failed too. It seems the amalgamated version is just a re-organization of JUCE source files. So I expected it should also compile. Am I right? If yes, I think there are some minor modification needed in the amalgamated version in order to get it work (with MinGW).


#4

I also had to do something to make the amalgated version work with VC 2008 Express - this has to do with the zlib compression library relying on preprocessor definitions. I had to insert or remove an #undef somewhere, or I’d get a message about Byte being an undefined symbol.

Perhaps things would be easier if the compression stuff was put last in amalgamated.cpp?

As for CodeBlocks/MinGW, I think it’s a nice stepping stone in the wading from MS to cross-platform development. First, do the project in VC, then set up a CodeBlocks/MinGW project and get rid of MS specifics, and when this works, it isn’t too hard to set up a CodeBlocks project on Linux.


#5

I think when I tried it I was just hitting bugs in gcc that were fixed long ago in gcc4, but mingw is still stuck on gcc3.3, right?

well, it’s tricky - there are loads of other things in there that I also moved to the end because they were causing problems, so moving the compression stuff might break one of those!


#6

In theory, you are right, and when the next version of MinGW comes out of alpha, you will be right in practise too. :smiley:

As it stands, it’s easier to harmonize code between GCC 4.x and MS compilers than with MinGW and either. The current MinGW is based on a kind of crap version of GCC, and also has strange and arbitrary limitations.

…like the length of a path in a command string for the compiler, the length of the string itself, the length of an include directive string, the number of sub folders in a path… you get the gist. :smiley:


#7

a good programmer has this link in his armory :slight_smile:
http://www.tdragon.net/recentgcc/

Code::Blocks + MinGW (GCC 4.3.1) is a powerful portable weapon for one’s masterpiece :wink:
Code::Blocks nightly builds (Windows portables, no install, just unzip and run) can be found here: http://forums.codeblocks.org/index.php?PHPSESSID=601c3ddad53ffe8dbcb9c473e50bb6c3&board=20.0

I have several issues as to MinGW (GCC) too.

Frankly, it’s not the right thing to compel people to use only someone else’s favourite compiler, Julian. The JUCE code is losing it’s portability now just because you prefer using MSVC IDE and compiler under Windoz. Now, the JUCE code is somewhat compiler (vendor) and platform SDK dependent :(. GCC is much more standard compliant and have many more other advantages in comparison with other compilers of choice. So, I think it deserves your more thorough attention.


#8

There’s a bug here, that appears on gcc only, and it’s independent of the compiler.

Simply change Byte to (unsigned char) at the given line, and it compiles nicely (at least in the version I have).


#9

thanks for the help X-Ryl669 i had this problem on my Ubuntu witg gcc4

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

but unsigned char fixed it.