전에 주 전에 스택 트레이스를 받고 있어요 :C++ segfault의 주요 gtest
#include <gtest/gtest.h>
using namespace std;
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
스택 트레이스 :
프로그램은 신호 SIGSEGV, 분할 오류를 받았다. 에서 0x0000000000000000 ??()
#0 0x0000000000000000 in ??()
#1 0x00000000004e0b51 in std::locale::_S_initialize()()
#2 0x00000000004e0b93 in std::locale::locale()()
#3 0x000000000050d524 in std::ios_base::Init::Init()()
#4 0x0000000000401581 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /usr/include/c++/4.9/iostream:74
#5 0x00000000004015b3 in _GLOBAL__sub_I_testsmain.cpp(void)() at ../../../bdf_cpp_tests/testsmain.cpp:18
#6 0x000000000053cdd7 in __libc_csu_init()
#7 0x000000000053c3de in generic_start_main()
#8 0x000000000053c62a in __libc_start_main()
#9 0x00000000004013f9 in _start()
이 qmake를 5.7이며, g ++ 4.9.4
나는 이것이 실행 명령이라고 생각 : 나는에서이 문제로 실행 해요 :
g++ -c -m64 -pipe -std=gnu++11 -std=c++11 -Werror -pedantic -DTEST_RESOURCE_DIR=\"/home/eric/Documents/BDFCppLib/test_resources\" -DTEST_OUTPUT_DIR=\"/home/eric/Documents/BDFCppLib/test_resources/output\" -g -std=gnu++11 -Wall -W -fPIC -DDEBUG -I../../../bdf_cpp_tests -I/home/eric/Documents/BDFCppLib/shadow-ant/ubuntu64_gcc49_dev/bdf_cpp_tests -I../../../bdf_cpp_sdk/include -I../../../lib/ubuntu64_gcc49_dev/unpack/chunk_cpp/include -I../../../lib/ubuntu64_gcc49_dev/unpack/system/include -I/home/eric/Software/qt/5.7/gcc_64/mkspecs/linux-g++-64 -o testsmain.o ../../../bdf_cpp_tests/testsmain.cpp
g++ -o ../../../build/ubuntu64_gcc49_dev/bin/bdf_cpp_run_tests testsmain.o testutils.o -pthread -lrt -L/home/eric/Documents/BDFCppLib/build/ubuntu64_gcc49_dev/lib -static -lbdf -L/home/eric/Documents/BDFCppLib/lib/ubuntu64_gcc49_dev/unpack/chunk_cpp/lib -static -lchunk -L/home/eric/Documents/BDFCppLib/lib/ubuntu64_gcc49_dev/unpack/system/lib -lgtest
UPDATE 0 우분투 16.04. 나는 14.04로 VM을 만들었고, 코드를 복사했고 모든 것이 잘 돌아갔다. 세그 폴트 없음. 그래서 16.04와 관련해서 뭔가 다른 점이 있습니다.
업데이트 1 : 나는 이것이 googletest에 기인한다고 생각하기 시작했습니다. 16.06이 아닌 14.04에서 왜 작동하는지 알 수 없습니다. Google 테스트를 포함하고 사용하는 모든 항목은 즉각적인 세그먼트로 인해 실행할 수 없습니다.
qmake 파일은 어떻게 생겼습니까? – Samer
"이 명령이 실행되는 명령이라고 생각합니다."확실히 당신의 충돌 gtest 프로그램을 연결하는 명령은 아닙니다. [mcve]가 필요했습니다. –
그냥 다른 라인을 추가했습니다. 도움이됩니까? –