Fixed bug 3552 - Building SDL in release mode fails under VS 2017 RC
authorSam Lantinga <slouken@libsdl.org>
Mon, 09 Jan 2017 20:37:52 -0800
changeset 1080530a00d960dc9
parent 10804 1502bb751ca4
child 10806 36f40b8cc979
Fixed bug 3552 - Building SDL in release mode fails under VS 2017 RC

Lukasz Biel

Tried to compile SDL2 using newest version of VS.

Got:
SDL_audiocvt.obj : error LNK2019: unresolved external symbol memcpy referenced in function SDL_ResampleCVT
1>E:\Users\dotPo\Lib\SDL\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals

whole compilation process: http://pastebin.com/eWDAvBce

Steps to reproduce:
clone http://hg.libsdl.org/SDL using tortoise hg,
open SDL\VisualC\SDL.sln,
when promted if should retarget solution click ok,
select release x64 build type,
Build/Build Solution

attempt 2, using Visual Studio cmake support:
open folder SDL\
select release x64 build type,
run CMake\Build CMakeLists.txt
build fails

When switched to debug build type, buils succeeds in both cases.
VS 2017 is still beta.
src/audio/SDL_audiocvt.c
     1.1 --- a/src/audio/SDL_audiocvt.c	Mon Jan 09 16:31:57 2017 -0500
     1.2 +++ b/src/audio/SDL_audiocvt.c	Mon Jan 09 20:37:52 2017 -0800
     1.3 @@ -378,13 +378,10 @@
     1.4      float *dst = (float *) (cvt->buf + srclen);
     1.5      const int dstlen = (cvt->len * cvt->len_mult) - srclen;
     1.6      float state[8];
     1.7 -    int i;
     1.8  
     1.9      SDL_assert(format == AUDIO_F32SYS);
    1.10  
    1.11 -    for (i = 0; i < chans; i++) {
    1.12 -        state[i] = src[i];
    1.13 -    }
    1.14 +    SDL_memcpy(state, src, chans*sizeof(*src));
    1.15  
    1.16      cvt->len_cvt = SDL_ResampleAudioSimple(chans, cvt->rate_incr, state, src, srclen, dst, dstlen);
    1.17