'zerostruct' and mingw


#1

Please change 'zerostruct(astat)' to 'memset(&astat, 0, sizeof(astat))' in 

modules/juce_core/native/juce_win32_Network.cpp

so mingw cross compiling works better.  Thanks!
 


#2

And also add "#include <stdint.h" in juce_core/memory/juce_Atomic.h

so the 64bit mingw works


#3

What on earth is it complaining about?? That's perfectly legit code!


#4

FYI, I never had such issues with mingw


#5

I think I'm getting the same issue here:

 


$ make
Compiling Main.cpp
Compiling MainComponent.cpp
Compiling juce_core.cpp
In file included from ../../../../modules/juce_core/juce_core.cpp:195:0:
../../../../modules/juce_core/native/juce_win32_Network.cpp: In function 'void juce::MACAddressHelpers::getViaNetBios(juce::Array<juce::MACAddress>&)':
../../../../modules/juce_core/native/juce_win32_Network.cpp:411:38: error: no matching function for call to 'zerostruct(juce::MACAddressHelpers::getViaNetBios(j
uce::Array<juce::MACAddress>&)::ASTAT&)'
                     zerostruct (astat);
                                      ^
../../../../modules/juce_core/native/juce_win32_Network.cpp:411:38: note: candidate is:
In file included from ../../../../modules/juce_core/juce_core.h:162:0,
                 from ../../../../modules/juce_core/juce_core.cpp:44:
../../../../modules/juce_core/memory/juce_Memory.h:38:13: note: template<class Type> void juce::zerostruct(Type&)
 inline void zerostruct (Type& structure) noexcept                   { memset (&structure, 0, sizeof (structure)); }
             ^
../../../../modules/juce_core/memory/juce_Memory.h:38:13: note:   template argument deduction/substitution failed:
In file included from ../../../../modules/juce_core/juce_core.cpp:195:0:
../../../../modules/juce_core/native/juce_win32_Network.cpp: In substitution of 'template<class Type> void juce::zerostruct(Type&) [with Type = juce::MACAddress
Helpers::getViaNetBios(juce::Array<juce::MACAddress>&)::ASTAT]':
../../../../modules/juce_core/native/juce_win32_Network.cpp:411:38:   required from here
../../../../modules/juce_core/native/juce_win32_Network.cpp:411:38: error: template argument for 'template<class Type> void juce::zerostruct(Type&)' uses local
type 'juce::MACAddressHelpers::getViaNetBios(juce::Array<juce::MACAddress>&)::ASTAT'
                     zerostruct (astat);
                                      ^
../../../../modules/juce_core/native/juce_win32_Network.cpp:411:38: error:   trying to instantiate 'template<class Type> void juce::zerostruct(Type&)'
make: *** [build/intermediate/Debug/juce_core_1ee54a40.o] Error 1

This is with a fresh install of MinGW and latest JUCE.

What gives?

 


#6

By the way adding -std=c++11 to the $(CXX) options seems to have fixed this problem!

 

However I am now getting the following errors:

$ make
Compiling Main.cpp
In file included from ../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/juce_core.h:173:0,
                 from ../../Source/../JuceLibraryCode/modules/juce_core/juce_core.h:4,
                 from ../../Source/../JuceLibraryCode/JuceHeader.h:17,
                 from ../../Source/Main.cpp:10:
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF8.h: In member function 'int juce::CharPointer_UTF8:
:compareIgnoreCase(juce::CharPointer_UTF8) const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF8.h:425:41: error: 'stricmp' was not declared in thi
s scope
         return stricmp (data, other.data);
                                         ^
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF8.h: In member function 'juce::int64 juce::CharPoint
er_UTF8::getIntValue64() const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF8.h:485:29: error: '_atoi64' was not declared in thi
s scope
         return _atoi64 (data);
                             ^
In file included from ../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/juce_core.h:174:0,
                 from ../../Source/../JuceLibraryCode/modules/juce_core/juce_core.h:4,
                 from ../../Source/../JuceLibraryCode/JuceHeader.h:17,
                 from ../../Source/Main.cpp:10:
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h: In member function 'int juce::CharPointer_UTF1
6::compareIgnoreCase(juce::CharPointer_UTF16) const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h:355:42: error: '_wcsicmp' was not declared in t
his scope
         return _wcsicmp (data, other.data);
                                          ^
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h: In member function 'int juce::CharPointer_UTF1
6::compareIgnoreCaseUpTo(juce::CharPointer_UTF16, int) const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h:360:62: error: '_wcsnicmp' was not declared in
this scope
         return _wcsnicmp (data, other.data, (size_t) maxChars);
                                                              ^
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h: In member function 'int juce::CharPointer_UTF1
6::getIntValue32() const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h:412:27: error: '_wtoi' was not declared in this
 scope
         return _wtoi (data);
                           ^
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h: In member function 'juce::int64 juce::CharPoin
ter_UTF16::getIntValue64() const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_UTF16.h:422:29: error: '_wtoi64' was not declared in th
is scope
         return _wtoi64 (data);
                             ^
In file included from ../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/juce_core.h:176:0,
                 from ../../Source/../JuceLibraryCode/modules/juce_core/juce_core.h:4,
                 from ../../Source/../JuceLibraryCode/JuceHeader.h:17,
                 from ../../Source/Main.cpp:10:
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_ASCII.h: In member function 'int juce::CharPointer_ASCI
I::compareIgnoreCase(juce::CharPointer_ASCII) const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_ASCII.h:280:41: error: 'stricmp' was not declared in th
is scope
         return stricmp (data, other.data);
                                         ^
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_ASCII.h: In member function 'juce::int64 juce::CharPoin
ter_ASCII::getIntValue64() const':
../../Source/../JuceLibraryCode/modules/juce_core/../../../../../modules/juce_core/text/juce_CharPointer_ASCII.h:350:29: error: '_atoi64' was not declared in th
is scope
         return _atoi64 (data);
                             ^
make: *** [build/intermediate/Debug/Main_90ebc5c2.o] Error 1

 


#7

Looks like most of those places are where it needs to be told to use the posix call instead of the Windows one, e.g.

    int64 getIntValue64() const noexcept
    {
       #if JUCE_LINUX || JUCE_ANDROID || JUCE_MINGW
        return atoll (data);
       #elif JUCE_WINDOWS
        return _atoi64 (data);
       #else

..I don't have time to go through all those errors and test it with mingw myself, but if you wanted to do that and send me a diff it's probably quite a trivial set of changes to add to the codebase.