фатальная ошибка: файл 'boost / test / unit_test.hpp' не найден - PullRequest
0 голосов
/ 23 февраля 2019

Мне нужно включить Boost.Test в мою программу на C ++ на macOS.Перед этим мне сначала нужно протестировать make-файлы, используя пример: https://github.com/jsankey/boost.test-examples Включенный make-файл не работает, поэтому я изменил его.

TARGETS=main hello suites fixtures assertions
INC=-I/usr/local/boost/include
LDFLAGS=-L/usr/local/lib -lboost_unit_test_framework
all: $(TARGETS)

test: $(TARGETS) $(addprefix run-,$(TARGETS))

main.o: main.cpp
    $(CXX) $< $(INC) -c
hello.o: hello.cpp
    $(CXX) $< $(INC) -c
suites.o: suites.cpp
    $(CXX) $< $(INC) -c
fixtures.o: fixtures.cpp
    $(CXX) $< $(INC) -c
assertions.o: assertions.cpp
    $(CXX) $< $(INC) -c
main: main.o
    $(CXX) $^ $(LDFLAGS) -o $@
hello: hello.o
    $(CXX) $^ $(LDFLAGS) -o $@
suites: suites.o
    $(CXX) $^ $(LDFLAGS) -o $@
fixtures: fixtures.o
    $(CXX) $^ $(LDFLAGS) -o $@
assertions: assertions.o
    $(CXX) $^ $(LDFLAGS) -o $@

run-%: %
    -./$^ --output_format=XML --log_level=test_suite > $(^)-report.xml

clean:
     rm $(TARGETS) *-report.xml

EDITED: Теперь компиляция работаетЧто ж.Связывание с другой стороны вызывает ошибку, а именно:

ld: предупреждение: игнорирование файла /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr / lib / libSystem.tbd, файл был создан для неподдерживаемого формата файла (0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33), который не является связываемой архитектурой (x86_64): /Application::/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd Неопределенные символы для архитектуры x86_64: "__Unwind_Resume", на которые ссылается: boost :: unit_test :: singleton :: instance () в hello.o boost :: unit_test :: make_test_case (boost :: function const &, boost :: unit_test :: basic_cstring, boost :: unit_test :: basic_cstring, unsigned long) в hello.o universeInOrder_invoker () в hello.o boost:: unit_test :: singleton :: instance () в hello.o universeInOrder :: test_method () в hello.o boost :: unit_test :: lazy_ostream :: instance () в hello.o boost :: basic_wrap_stringstream :: str () в hello.o ... "___bzero", на который ссылается из: universeInOrder_invoker () в hello.o "___cxa_atexit", на который указывают:

boost :: unit_test :: singleton :: instance() в hello.o boost :: unit_test :: singleton :: instance () в hello.o boost :: unit_test :: lazy_ostream :: instance () в hello.o "_memcpy", на который ссылаются из: std :: __ 1:: char_traits :: copy (char *, char const *, unsigned long) в hello.o "_memset", на который ссылается: std :: __ 1 :: ostreambuf_iterator> std :: __ 1 :: __ pad_and_output> (std :: __ 1 ::ostreambuf_iterator>, char const *, char const *, char const *, std :: __ 1 :: ios_base &, char) в hello.o std :: __ 1 :: char_traits :: assign (char *, unsigned long, char) в привет.o boost :: basic_wrap_stringstream :: basic_wrap_stringstream () в hello.o std :: __ 1 :: basic_stringbuf, std :: __ 1 :: allocator> :: seekoff (long long, std :: __ 1 :: ios_base :: seekdir, без знакаint) в hello.o std :: __ 1 :: basic_stringbuf, std :: __ 1 :: allocator> :: str () const в hello.o std :: __ 1 :: basic_ostream> & boost :: unit_test :: operator <<, символconst> (std :: __ 1 :: basic_ostream> &, boost :: unit_test :: basic_cstring const &) в hello.o "_strcmp", на который ссылаются из:

boost :: typeindex :: stl_type_index :: equal (boost :: typeindex :: stl_type_index const &) const в hello.o "_strlen", на который ссылается: std :: __ 1 :: char_traits :: length (char const *) в hello.o ld: символ (ы) не найден для архитектурыx86_64 clang-4.0: ошибка: сбой команды компоновщика с кодом выхода 1 (используйте -v для просмотра вызова) make: *** [Makefile: 21: hello] Ошибка 1

...