How can i add a new library to the Ardupilot

I just write my library .cpp and .h in the library document , and add the library in the APMrover2/wsrcipt , but something wrong when i ./waf rover. it happens that :

Build failed
-> task in ‘objs/AP_pol’ failed (exit status 1):
{task 140433946212664: cxx AP_pol.cpp -> AP_pol.cpp.0.o}
:
{task 140433946212664: cxx AP_pol.cpp -> AP_pol.cpp.0.o}
[’/usr/bin/g++’, ‘-std=gnu++11’, ‘-fdata-sections’, ‘-ffunction-sections’, ‘-fno-exceptions’, ‘-fsigned-char’, ‘-Wall’, ‘-Wextra’, ‘-Wformat’, ‘-Wpointer-arith’, ‘-Wcast-align’, ‘-Wundef’, ‘-Wno-unused-parameter’, ‘-Wno-missing-field-initializers’, ‘-Wno-reorder’, ‘-Wno-redundant-decls’, ‘-Wno-unknown-pragmas’, ‘-Werror=attributes’, ‘-Werror=format-security’, ‘-Werror=enum-compare’, ‘-Werror=array-bounds’, ‘-Werror=uninitialized’, ‘-Werror=init-self’, ‘-Werror=narrowing’, ‘-Werror=return-type’, ‘-Werror=switch’, ‘-Werror=sign-compare’, ‘-Werror=type-limits’, ‘-Werror=unused-result’, ‘-Werror=shadow’, ‘-Werror=unused-variable’, ‘-Wfatal-errors’, ‘-Wno-trigraphs’, ‘-Werror=parentheses’, ‘-Werror=unused-but-set-variable’, ‘-Werror=float-equal’, ‘-O3’, ‘-MMD’, ‘-include’, ‘ap_config.h’, ‘-Ilibraries’, ‘-Ilibraries/GCS_MAVLink’, ‘-I.’, ‘-I…/…/libraries’, ‘-I…/…/libraries/AP_Common/missing’, ‘-DSKETCHBOOK="/home/lmy/ardupilot"’, ‘-DAP_SCRIPTING_CHECKS=1’, ‘-DCONFIG_HAL_BOARD=HAL_BOARD_SITL’, ‘-DCONFIG_HAL_BOARD_SUBTYPE=HAL_BOARD_SUBTYPE_NONE’, ‘…/…/libraries/AP_pol/AP_pol.cpp’, ‘-c’, ‘-olibraries/AP_pol/AP_pol.cpp.0.o’]

can somebody helps me about it,thanks very much!
my code version is the newist.