Catherine Hwang
Catherine Hwang

Reputation: 1030

Amazon Libs3 Issues

I'm trying to install a library that I can use to access Amazon's S3 service (I just need to be able to upload files there). The code needs to be in C++ because it's going to be bundled as part of an application I'm working on.

I'm trying to work with Bryan Ischo's library located here: http://libs3.ischo.com.s3.amazonaws.com/index.html

I'm having some installation issues though. I changed GNUMakefile.macosx to GNUMakefile and then ran "sudo make install", as I'm developing on a Mac. Then I made a test .cpp file.

#include <libs3.h>
...a few other things...
int main() {
cout << "Hello World!" << endl;
S3_initialize(NULL, S3_INIT_ALL);   
return 0;
}

All I want to do is to be able to initialize the library, since this is what his API says to do. However, I get back this error:

Undefined symbols:
  "_S3_initialize", referenced from:
  _main in ccRcG0yS.o
ld: symbol(s) not found

I'd like some help either fixing my installation of libs3 or getting a few tips on accessing S3 through C++.

Thanks!

Upvotes: 1

Views: 2025

Answers (2)

Priyank Desai
Priyank Desai

Reputation: 3835

I faced a similar problem with executing a C file using Byan Ischo's library on mac and I had to add some more parameters before I was able to successfully run my test file.

How to compile libs3 on mac?

sudo make DESTDIR=/opt/local install

How to compile test.c?

cc test.c -I/opt/local/include -L/opt/local/lib -ls3

How to execute a.out?

DYLD_LIBRARY_PATH=/opt/local/lib ./a.out

Upvotes: 0

Yann Ramin
Yann Ramin

Reputation: 33177

Your test application is not linking with libs3. You will need to add it to the linker flags, such as -ls3 (if the library is libs3.so/a)

Upvotes: 3

Related Questions