google test 컴파일 에러 해결법
Programminggoogle test는 C++ 단위 테스트 환경 구축을 위한 프레임워크이다.
In file included from sample.cpp:1:
In file included from /usr/local/include/gtest/gtest.h:62:
In file included from /usr/local/include/gtest/internal/gtest-internal.h:40:
/usr/local/include/gtest/internal/gtest-port.h:826:12: error: no member named
'make_tuple' in namespace 'std'
using std::make_tuple;
~~~~~^
/usr/local/include/gtest/internal/gtest-port.h:827:12: error: no member named 'tuple' in
namespace 'std'
using std::tuple;
~~~~~^
/usr/local/include/gtest/internal/gtest-port.h:906:3: warning: deleted function
definitions are a C++11 extension [-Wc++11-extensions]
GTEST_DISALLOW_ASSIGN_(RE);
^
/usr/local/include/gtest/internal/gtest-port.h:672:34: note: expanded from macro
'GTEST_DISALLOW_ASSIGN_'
void operator=(type const &) = delete
^
/usr/local/include/gtest/internal/gtest-port.h:949:3: warning: deleted function
definitions are a C++11 extension [-Wc++11-extensions]
GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog);
^
/usr/local/include/gtest/internal/gtest-port.h:677:24: note: expanded from macro
'GTEST_DISALLOW_COPY_AND_ASSIGN_'
type(type const &) = delete; \
...
위의 에러는 google test를 포함한 테스트 코드가 -std=c++11
혹은 이상의 플래그를 포함하지 않아서 발생하는 문제이다.
Makefile
의 경우에는 CXXFLAGS=-std=c++11
을 추가해주면 해결된다.
+추가내용)
Undefined symbols for architecture x86_64:
"testing::Test::SetUp()", referenced from:
...
위의 경우에는 라이브러리가 연결되지 않아서 발생하는 문제이다.
마찬가지로 Makefile
에서는 LDLIBS=-lgtest_main -lgtest -pthread
플래그를 추가하여 해결 할 수 있다.
'Programming' 카테고리의 다른 글
Gist에 이미지를 업로드 하는 방법 (0) | 2020.01.11 |
---|---|
VIM :help 전체화면으로 보는방법 (0) | 2020.01.09 |
VIM script로 파일 경로 문자열에서 파일명 뽑아내는 방법 (0) | 2020.01.05 |
Unix/Linux 명령어 옵션 벤치마크 하는방법 (0) | 2019.12.31 |
Makefile에서 dependency가 누락되는 현상 해결법 (0) | 2019.12.30 |