c++ - aws-sdk-cpp: unresolved symbols -
i trying build simple example using aws sdk cpp. stumbled on building step. linking libaws-cpp-sdk-s3.so library, supposed have symbols source file. linker cannot find couple of them. source file is:
#include <aws/core/aws.h> int main( int argc, char ** argv) { aws::sdkoptions options; aws::initapi(options); { // make sdk calls here. } aws::shutdownapi(options); return 0; }
by using makefile:
cc = g++ cflags = -g -c -wall -std=c++11 ldflags = -g executable = ex1 rm = rm -f sources = main.cpp objs = $(sources:.cpp=.o) all: $(executable) $(executable): main.o -laws-cpp-sdk-s3 $(cc) $(ldflags) main.o -o $@ main.o: main.cpp $(cc) $(cflags) $^ -o $@ .phony: clean clean: $(rm) $(executable) $(objs) $(sources:.cpp=.d)
when run make, got error. why? built
g++ -g main.o -o ex1 main.o: in function main': /home/username/workspace/ex1/src/main.cpp:6: undefined reference to
aws::initapi(aws::sdkoptions const&)' /home/username/workspace/ex1/src/main.cpp:12: undefined reference `aws::shutdownapi(aws::sdkoptions const&)' collect2: error: ld returned 1 exit status makefile:13: recipe target 'ex1' failed make: *** [ex1] error 1
i don't see linking libaws-cpp-sdk-core
you need:
$(executable): main.o -laws-cpp-sdk-s3 -laws-cpp-sdk-core $(cc) $(ldflags) main.o -o $@
Comments
Post a Comment