Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

C SDK integration - getting Undefined symbols



I am writing a c++ plugin for my application, The plugin will be a shared library and my application wil use the plugin,The plugin has the calls to new relic api (which is linked usign libnewrelic.a) which is linked statically. after i build my plugin I see error when i load the plugin using dlopen and it it shows undefined symbols to the relic apis.
any help is appreciated.

plugin = libdmmonitorso

this plugin is built using below flags:
g++ -m64 -Wno-deprecated -O4 -DSYS_V -D_REENTRANT -Dunix -D_DM_NL_MULTIPROCESS -I. -I…/common/hdr -I…/hdr -I/root/anitha/depot/3rdParty/External/newrelic/include -fPIC -rdynamic -pthread dmMonitorFactory.o dmMonitorInstrument.o dmNewRelicContext.o dmLibrary.o dmlog.o dmPlatform.o StringTokenizer.o -Wl,–whole-archive -shared -o -L/newrelic/lib/libnewrelic.a -Wl,–no-whole-archive /usr/lib/ -lm

This generates my plugin but I am unable to load this library.

nm |grep newrelic_create*
U newrelic_create_app
** U newrelic_create_app_config**

as i get undefined symbols.
Any help is appreciated.
I want to use the plugin based approach to monitor my c++.application


Hi @aseshadr,

To link a static library, pass the full path without leading -L. So instead of passing -L/newrelic/lib/libnewrelic.a to your linker, just pass /newrelic/lib/libnewrelic.a (or whatever is the path to the static library).

Please let us know if that helps.