Topic: Need Help Linking Simple App With VS2008

[Migrated from SourceForge forums]


xangis
(2010-08-03 20:06:43 UTC)

I can build yaSSL fine on Windows using VS2008.

I created a simple project to get started with using yaSSL, but can't seem to get the build/library settings quite right.

Here are the errors I get when linking:

1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall yaSSL::Client::~Client(void)" (??1Client@yaSSL@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: int __thiscall yaSSL::Client::Read(void *,int)" (?Read@Client@yaSSL@@QAEHPAXH@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: int __thiscall yaSSL::Client::Write(void const *,int)" (?Write@Client@yaSSL@@QAEHPBXH@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: int __thiscall yaSSL::Client::Connect(unsigned int)" (?Connect@Client@yaSSL@@QAEHI@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall yaSSL::Client::SetCA(char const *)" (?SetCA@Client@yaSSL@@QAEXPBD@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall yaSSL::Client::Client(void)" (??0Client@yaSSL@@QAE@XZ) referenced in function _main
1>C:\Users\xangis\Desktop\lib\yassl-2.0.0\yassl-2.0.0\test\msw\Debug\msw.exe : fatal error LNK1120: 6 unresolved externals

The project is set up to link to these libraries:
yassl.lib ws2_32.lib taocrypt.lib

Here is the source code I'm using, very simple:

#include <iostream>
#include "../include/yassl.hpp"

using namespace std;

int main(int argc, char** argv)
{
    cout << "Creating client class." << endl;
    yaSSL::Client client;
    cout << "Setting certificate to ca-cert.pem." << endl;
    client.SetCA("ca-cert.pem");
    cout << "Creating socket." << endl;
    yaSSL::SOCKET_T socket;
    cout << "Connecting socket." << endl;
    client.Connect(socket);
    cout << "Sending 'hello yaSSL' message to server." << endl;
    client.Write("hello yaSSL", 12);
    cout << "Reading server response." << endl;
    char buffer[80];
    client.Read(buffer, 80);
    std::cout << "Server sent:" << buffer << std::endl; 

    return 0;
}

Am I missing anything obvious?  It seems like the methods that it's complaining about should be found in yassl.lib.


touska
(2010-08-03 20:26:02 UTC)

Hi, thanks for the question.

The yaSSL API is deprecated since no one really wanted to use it, only the OpenSSL API.  But it's still included in the src, just add yassl.cpp to the yassl lib source files and rebuild.

You'll also need to connect the socket with TCP before passing it to SSL.  client.Connect() does an SSL connect on an already connected TCP socket.


xangis
(2010-08-04 18:30:12 UTC)

OK, thank you for letting me know.  I'll try doing things the via the OpenSSL API.