How to use static library libsodium.lib in C++Builder?

276 Views Asked by At

Under C++Builder, I have encountered an error when linking trying to use static library libsodium.lib.

The test under Visual Studio works fine.

Any idea to help ?

This is my code :

// C++ Builder

//...
#define SODIUM_STATIC
extern "C" {
#include <sodium.h>
}

void __fastcall TForm1::FormShow(TObject *Sender)
{//
 if (sodium_init() < 0) Edit1->Text = L"Failure"; else Edit1->Text = L"Success";
}

//=> Linker message = unresolved external symbol '_sodium_init'

// Visual C++
//...
#define SODIUM_STATIC
#include <sodium.h>

int main()
{//
 if (sodium_init() < 0) {std::cout << "Failure" << std::endl; return 1;}
 std::cout << "Success" << std::endl;
 return 0;
}

=> Working fine !

0

There are 0 best solutions below