2016-06-21 2 views
2

다음 오류가 런타임시 발생이 런타임 오류의 원인은 무엇이며 어떻게 수정할 수 있습니까?

프로 시저 시작 지점 _ZSt24__throw_out_of_range_fmtPKcz는 동적 링크 라이브러리 "TEST.EXE"에서 찾을 수 없습니다.

어떤 기능이 엔트리 포인트 오류를 ​​일으키는 지 알아 내기 위해 C++ 디 랭글러를 사용했습니다. 기능은 다음과 같습니다 std::__throw_out_of_range_fmt(char const*, ...)

나는 다음과 같은 라이브러리에 연결하고

: (동적, 혼자 소스에서 컴파일, 내 프로젝트에 대한 GCC의 동일한 버전을 사용하고 그

  • SDL2 (4.9.3)). 나는 내가 사용 된 사전 구축 된 버전은 어떻게 든 갈등을 야기했다고 생각했기 때문에 나는 내 프로젝트에서 사용하는 GCC의 동일한 버전의 소스에서 SDL2를 컴파일

  • GLEW (프로젝트에 추가 소스) 다른 C++ 표준 라이브러리에서. 그런 다음이 빌드에 동적으로 링크하려고 시도했지만 정확히 동일한 런타임 오류가 지속되었습니다. (윈도우 배치 스크립트를 통해 컴파일)

    컴파일 & 링크하기 스크립트 로그 : 런타임시 인쇄

    C:\Users\Harrand\Desktop\Ocular GEng\src\camera.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\datatranslation.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\glew.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\light.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\listeners.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\matrix.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\mesh.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\model_loader.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\object.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\quaternion.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\shader.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\stb_image.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\test.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\texture.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\timekeeper.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\utility.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\vector.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\window.o 
    C:\Users\Harrand\Desktop\Ocular GEng\src\world.o 
         19 file(s) moved. 
    Compilation Completed, ".o" files are in "C:\Users\Harrand\Desktop\Ocular GEng\cpl\Thu 08.25.2016" 
    Using built-in specs. 
    COLLECT_GCC=g++ 
    COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe 
    Target: mingw32 
    Configured with: ../src/gcc-4.9.3/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libstdcxx-debug --with-tune=generic --enable-nls 
    Thread model: win32 
    gcc version 4.9.3 (GCC) 
    COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ 
    LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../ 
    COLLECT_GCC_OPTIONS='-v' '-LC:\Users\Harrand\Desktop\Ocular GEng\lib' '-LC:\Users\Harrand\Desktop\Ocular GEng\Lua\5.3.2\lib' '-o' 'oculargame-test.exe' '-shared-libgcc' '-mtune=generic' '-march=i586' 
    c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/collect2.exe -plugin c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/liblto_plugin-0.dll -plugin-opt=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\Harrand\AppData\Local\Temp\ccUhcnbk.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -Bdynamic -u ___register_frame_info -u ___deregister_frame_info -o oculargame-test.exe c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtbegin.o -LC:\Users\Harrand\Desktop\Ocular GEng\lib -LC:\Users\Harrand\Desktop\Ocular GEng\Lua\5.3.2\lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../.. camera.o datatranslation.o glew.o light.o listeners.o matrix.o mesh.o model_loader.o object.o quaternion.o shader.o stb_image.o test.o texture.o timekeeper.o utility.o vector.o window.o world.o -lOpenGL32 -lSDL2 -lSDL2main C:\Users\Harrand\Desktop\Ocular GEng\res\exe\ocular.res -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtend.o 
         1 file(s) moved. 
    Linking Completed, "oculargame-test.exe" is in "C:\Users\Harrand\Desktop\Ocular GEng\cpl\Thu 08.25.2016\lnk" 
    

    만 오류 메시지가이 질문의 제목입니다. 나는 다음과 같은 libs가에 링크하고 있습니다 :

    • libSDL2.a (SDL2에 대한 DLL의 IMPLIB)
    • libSDL2main.a

    난 단지 동적 링크 라이브러리 libSDL2.dll에 연결하고있다. 필자가 이전에 의심했던 점은 SDL2가 직접 컴파일되기 전에 미리 컴파일 되었기 때문에 컴파일러 버전에 충돌이 있다는 것입니다. 그러나, 나는 이것이 사실이 아니라는 것을 알고있다. 프로젝트에 GLEW 소스 코드를 추가했기 때문에이 오류가 발생할 수 있습니까?

  • +0

    나는 동일한 문제를 가지고 있는데, 그 중 일부는 libs가 다른 버전의 컴파일러로 컴파일되었고 다른 버전의 표준 C++ 라이브러리에 링크되어 있기 때문에 자신이 개발 한 응용 프로그램을 컴파일하는 것과 같습니다.이러 한 libs와 동일한 컴파일러를 설치하거나 소스를 다운로드하여 현재 컴파일러로 컴파일해야합니다. 당신이 그것을 시도 할 때, 그것이 효과가 있는지 말해봐. – Youda008

    +0

    @ Youda008 나는 당신이 말한 것을 이해하며, 당신이 옳다고 믿습니다. 그러나 문제가 처음 발생했을 때 프로그램을 실행하려고 할 때마다 오류가 발생하지 않았습니다. 때로는 전혀 변경하지 않고 오류없이 실행되었습니다. 또한 가장 최근의 편집을 확인하여 내가 만든 실현을 볼 수 있습니다. 나는 다시 한 번 잃어 버리고, 당신이 제공 할 정보가 있다면, 나는 그것을 환영 할 것이다. – Harrand

    답변

    1

    나의 초기 의심이 맞지 않았지만 올바른 길로 가고있다 : 내가 사용하려고했던 MinGW의 버전이 오래 전에 시스템 경로에 설치 한 MinGW의 버전과 같지 않다. 이것의 효과는 G ++ DLL에 대한 실행 파일의 종속성이 기본적으로 내가 설치 한 MinGW 버전의 DLL을 대상으로한다는 것입니다. 잘못된 버전. 이로 인해 런타임 오류가 발생했습니다.

    이 문제는 대체하여 해결되었습니다 :

    "C:\MinGW\bin\g++"*.o -L%libdir% -L"%scriptdir%\Lua\5.3.2\lib" -lOpenGL32 -lSDL2 -lSDL2main "%scriptdir%\res\exe\ocular.res" -o "oculargame-test.exe" 
    

    "C:\MinGW\bin\g++" -static-libgcc -static-libstdc++ *.o -L%libdir% -L"%scriptdir%\Lua\5.3.2\lib" -lOpenGL32 -lSDL2 -lSDL2main "%scriptdir%\res\exe\ocular.res" -o "oculargame-test.exe" 
    

    와 내가 명령에 플래그를 -static-libgcc -static-libstdc++를 추가 그래서 내가 C "에서 (사용하고 싶었던는 MinGW 버전 : \ MinGW \ bin ") 충돌이 발생하지 않도록 실행 파일에 종속성을 정적으로 연결합니다. 나는 이것이 비슷한 까다로운 문제로 다른 사람들을 돕기를 바랍니다.

    관련 문제