Forums

Full Version: Build error with git-84ed1a7
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
    CPP build/carsound.o
src/carsound.cpp: In member function ‘void CarSound::Update(const CarDynamics&, float)’:
src/carsound.cpp:332:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = tiresqueal;
                 ^
src/carsound.cpp:336:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = grasssound;
                 ^
src/carsound.cpp:341:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = gravelsound;
                 ^
src/carsound.cpp:346:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = tiresqueal;
                 ^
src/carsound.cpp:352:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = grasssound;
                 ^
src/carsound.cpp:358:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = tiresqueal;
                 ^
scons: *** [build/carsound.o] Error 1
scons: building terminated because of errors.
Any suggestions as to what I am doing wrong?
(10-22-2013, 12:02 PM)tomlowshang Wrote: [ -> ]
Code:
    CPP build/carsound.o
src/carsound.cpp: In member function ‘void CarSound::Update(const CarDynamics&, float)’:
src/carsound.cpp:332:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = tiresqueal;
                 ^
src/carsound.cpp:336:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = grasssound;
                 ^
src/carsound.cpp:341:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = gravelsound;
                 ^
src/carsound.cpp:346:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = tiresqueal;
                 ^
src/carsound.cpp:352:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = grasssound;
                 ^
src/carsound.cpp:358:17: error: cannot convert ‘unsigned int [4]’ to ‘size_t* {aka long unsigned int*}’ in assignment
    sound_active = tiresqueal;
                 ^
scons: *** [build/carsound.o] Error 1
scons: building terminated because of errors.
Any suggestions as to what I am doing wrong?
Yeah, that sound selection code wasn't 64bit safe. I've pushed a fix.
Commit 41918ae fixes original error but build fails again with differrent error. Looks like a similar problem.
Code:
CPP build/trackloader.o
src/trackloader.cpp: In member function ‘bool Track::Loader::AddObject(const Track::Loader::Object&)’:
src/trackloader.cpp:692:88: error: no matching function for call to ‘max(unsigned int, std::basic_string<char>::size_type)’
   std::string texname = object.texture.substr(0, std::max(0u, object.texture.length()-4)) + "-misc1.png";
                                                                                        ^
src/trackloader.cpp:692:88: note: candidates are:
In file included from /usr/include/c++/4.8/list:60:0,
                 from src/joeserialize.h:23,
                 from src/mathvector.h:23,
                 from src/bezier.h:23,
                 from src/roadpatch.h:23,
                 from src/roadstrip.h:23,
                 from src/track.h:23,
                 from src/trackloader.h:23,
                 from src/trackloader.cpp:20:
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:   template argument deduction/substitution failed:
src/trackloader.cpp:692:88: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘std::basic_string<char>::size_type {aka long unsigned int}’)
   std::string texname = object.texture.substr(0, std::max(0u, object.texture.length()-4)) + "-misc1.png";
                                                                                        ^
In file included from /usr/include/c++/4.8/list:60:0,
                 from src/joeserialize.h:23,
                 from src/mathvector.h:23,
                 from src/bezier.h:23,
                 from src/roadpatch.h:23,
                 from src/roadstrip.h:23,
                 from src/track.h:23,
                 from src/trackloader.h:23,
                 from src/trackloader.cpp:20:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:   template argument deduction/substitution failed:
src/trackloader.cpp:692:88: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘std::basic_string<char>::size_type {aka long unsigned int}’)
   std::string texname = object.texture.substr(0, std::max(0u, object.texture.length()-4)) + "-misc1.png";
                                                                                        ^
src/trackloader.cpp:706:88: error: no matching function for call to ‘max(unsigned int, std::basic_string<char>::size_type)’
   std::string texname = object.texture.substr(0, std::max(0u, object.texture.length()-4)) + "-misc2.png";
                                                                                        ^
src/trackloader.cpp:706:88: note: candidates are:
In file included from /usr/include/c++/4.8/list:60:0,
                 from src/joeserialize.h:23,
                 from src/mathvector.h:23,
                 from src/bezier.h:23,
                 from src/roadpatch.h:23,
                 from src/roadstrip.h:23,
                 from src/track.h:23,
                 from src/trackloader.h:23,
                 from src/trackloader.cpp:20:
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:   template argument deduction/substitution failed:
src/trackloader.cpp:706:88: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘std::basic_string<char>::size_type {aka long unsigned int}’)
   std::string texname = object.texture.substr(0, std::max(0u, object.texture.length()-4)) + "-misc2.png";
                                                                                        ^
In file included from /usr/include/c++/4.8/list:60:0,
                 from src/joeserialize.h:23,
                 from src/mathvector.h:23,
                 from src/bezier.h:23,
                 from src/roadpatch.h:23,
                 from src/roadstrip.h:23,
                 from src/track.h:23,
                 from src/trackloader.h:23,
                 from src/trackloader.cpp:20:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:   template argument deduction/substitution failed:
src/trackloader.cpp:706:88: note:   deduced conflicting types for parameter ‘const _Tp’ (‘unsigned int’ and ‘std::basic_string<char>::size_type {aka long unsigned int}’)
   std::string texname = object.texture.substr(0, std::max(0u, object.texture.length()-4)) + "-misc2.png";
                                                                                        ^
scons: *** [build/trackloader.o] Error 1
scons: building terminated because of errors.
Yep, need to setup 64bit build. You can fix it by replacing "std::max(0u, " with "std::max<int>(0, "
That worked, thanks.