Trying to use Mega C++ SDK

Apr 7, 2020 at 1:17pm
I am trying to use this C++ SDK https://github.com/meganz/sdk

At first it seemed pretty straightforward, just add the megaapi.h header and start using it, but I am having a lot of troubles

Here is what I have done so far:
I downloaded the repo and copied all the contents from the folder 'include' to the folder 'include' in MinGW, then I tried to compile this example https://github.com/meganz/sdk/blob/develop/examples/win32/testmega/main.cpp.

It throws a lot of undefined references to functions errors such as these examples,

undefined reference to `mega::MegaListener::onUserAlertsUpdate(mega::MegaApi*, mega::MegaUserAlertList*)'|

undefined reference to `mega::MegaError::getErrorCode() const'|

undefined reference to `mega::MegaApi::getRootNode()'|

which are the functions in classes in megaapi.h header.
The definitions of these functions are, however, in the .cpp files in the 'src' folder. I tried to copy these files to the 'include' folder in MinGW but I still have the same problems.

I never used any SDK and I have no idea how to build this one, the steps I should take.

Any guidance would be appreciated!!
Last edited on Apr 7, 2020 at 1:21pm
Apr 7, 2020 at 1:36pm
just add the megaapi.h header and start using it,
Doesn't look like it. There's a whole src directory tree. It's not a header-only library.

You have to build the library, which will eventually get you either .lib or .a files.
./configure
make
I usually run msys2 and run these commands.

There might be other dependencies before you can successfully build the library, as well. See the readme on that github page. Eventually, you'll have library files that you can then link to when you build your individual program.
Last edited on Apr 7, 2020 at 1:38pm
Apr 12, 2020 at 3:52pm
@Ganado thanks, I tried that but couldn't build it because of a missing header that I couldn't seem to resolve. Even posted it as an issue in SDK repo but with no answer so far.
Topic archived. No new replies allowed.