Error compiling 1.46 on VC 7.1 (2003); free()


#1

I try to compile juce version 1.46 with VC++ 7.1. I converted the VC6 project to VC7 and compiled in debug configuration. I got "error C2883: ‘pnglibNamespace::free’ and same for malloc. These errors are conflicts of declaration. I commented out lines 50 and 51 of “juce_PNGLoader.cpp”

 using ::malloc;
 using ::free;

as described in topic “pnglibNamespace[fixed]”. This solved the problem.

After I compiled release configuration and had error C2668: ‘free’ ambiguous call in “juce_OggVorbisAudioFormat.cpp” when using “juce_ArrayAllocationBase.h” line 74

   ~ArrayAllocationBase() throw()
   {
       if (elements != 0)
           juce_free (elements);

The compiler is hesitating between:
stdlib.h ‘void free(void *)’ and
malloc.h 'void OggVorbisNamespace::free(void *)'
I have not found a solution to solve that and I finally commented out #define JUCE_USE_OGGVORBIS, and had no problem up to now.

I will not use OggVorbis in short term, but I am interested if someone has a solution.


#2

I am now compiling my application in debug configuration. The application is about VST. I get 2 warnings during compile for “juce_VstWrapper.cpp” and “juce_AudioProcessor.cpp”. Both warning are:

Compiler Warning (level 3) C4390 ‘;’ : empty controlled statement found; is this the intent?

Both warnings have comments about:

juce_ArrayAllocationBase.h(74)
juce_Array.h(62)
juce_Typeface.h(271)

It looks like the linker founds that free() is a void macro. I think that when the compiler creates an instance of a StringArray the destructor of the Array contains no call to free(). Is it the right situation? I had not that problem with previous version 1.45.


#3

Have you tried with the tip from SVN? It’s a bit hard to check this sort of thing out when you’re not using the same code as me…