473,587 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Link time errors

Hi

I am trying to build a small client-server program using OpenSSL functions. I get errors on trying to build the program using Visual Studio .Net (Visual C++ 7.0). I am new to Visual Studio environment, pls bear with me if this one is a trivial question

Here's the procedure I followed

(1) Copied libeay32.lib and ssleay32.lib to C:\program files\Microsoft Visual Studio .NET\Vc7\li
(2) Copied the OpenSSL header files to c:\program files\Microsoft Visual Studio .NET\Vc7\includ e\openssl folde

(3) On building the program, I get the following errors

SSL error LNK2019: unresolved external symbol _ERR_print_erro rs_fp referenced in function _handle_erro
SSL error LNK2019: unresolved external symbol _SSL_load_error _strings referenced in function _init_OpenSS
SSL error LNK2019: unresolved external symbol _SSL_library_in it referenced in function _init_OpenSS
SSL error LNK2019: unresolved external symbol _THREAD_setup referenced in function _init_OpenSS
SSL error LNK2019: unresolved external symbol _BIO_read referenced in function _do_server_loo
SSL error LNK2019: unresolved external symbol _ERR_remove_sta te referenced in function _server_threa
SSL error LNK2019: unresolved external symbol _BIO_free referenced in function _server_threa
SSL error LNK2019: unresolved external symbol _BIO_pop referenced in function _mai
SSL error LNK2019: unresolved external symbol _BIO_ctrl referenced in function _mai
SSL error LNK2019: unresolved external symbol _BIO_new_accept referenced in function _mai
SSL fatal error LNK1120: 10 unresolved external

I understand that the tool is unable to obtain symbols for these SSL functions. Isn't it sufficient that I copy these libraries to the location specified in step (1) ? Would this suffice as it's in the standard path where Visual Studio should look for the library ? Am I overlooking some cruical aspect here

Any help in this regard would be much appreciated

Thanks
Krishnan

Here's the complete program

------------------------------------------------------------------------------
Server.c

#include "common.h

#define CERTFILE "server.pem
SSL_CTX *setup_server_c tx(void

SSL_CTX *ctx

ctx = SSL_CTX_new(SSL v23_method( ))
if (SSL_CTX_use_ce rtificate_chain _file(ctx, CERTFILE) != 1
int_error("Erro r loading certificate from file")
if (SSL_CTX_use_Pr ivateKey_file(c tx, CERTFILE, SSL_FILETYPE_PE M
!= 1
int_error("Erro r loading private key from file")
return ctx
int do_server_loop( SSL *ssl

int err, nread
char buf[80]

d

for (nread = 0; nread < sizeof(buf); nread += err

err = SSL_read(ssl, buf + nread, sizeof(buf) - nread)
if (err <= 0
break

fprintf(stdout, "%s", buf)

while (err > 0)
return (SSL_get_shutdo wn(ssl) & SSL_RECEIVED_SH UTDOWN) ? 1 : 0
void THREAD_CC server_thread(v oid *arg

SSL *ssl = (SSL *)arg

#ifndef WIN3
pthread_detach( pthread_self( ))
#endi
if (SSL_accept(ssl ) <= 0
int_error("Erro r accepting SSL connection")
fprintf(stderr, "SSL Connection opened\n")
if (do_server_loop (ssl)
SSL_shutdown(ss l)
els
SSL_clear(ssl)
fprintf(stderr, "SSL Connection closed\n")
SSL_free(ssl)

ERR_remove_stat e(0)

#ifdef WIN3
_endthread( )
#endi
int main(int argc, char *argv[]

BIO *acc, *client
SSL *ssl
SSL_CTX *ctx
THREAD_TYPE tid

init_OpenSSL( )
seed_prng( )

ctx = setup_server_ct x( )

acc = BIO_new_accept( PORT)
if (!acc
int_error("Erro r creating server socket")

if (BIO_do_accept( acc) <= 0
int_error("Erro r binding server socket")

for (;;

if (BIO_do_accept( acc) <= 0
int_error("Erro r accepting connection")

client = BIO_pop(acc)
if (!(ssl = SSL_new(ctx))
int_error("Erro r creating SSL context")

SSL_set_bio(ssl , client, client)
THREAD_CREATE(t id, (void *)server_thread , ssl)
}

SSL_CTX_free(ct x);
BIO_free(acc);
return 0;
}

--------------------------------------------------------------------------------

Common.h

#ifndef COMMON_H
#define COMMON_H

#include <string.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
#include "reentrant. h"

#ifndef WIN32
#include <pthread.h>
#define THREAD_CC
#define THREAD_TYPE pthread_t
#define THREAD_CREATE(t id, entry, arg) pthread_create( &(tid), NULL, (entry), (arg))
#else
#include <windows.h>
#define THREAD_CC __cdecl
#define THREAD_TYPE DWORD
#define THREAD_CREATE(t id, entry, arg) do { _beginthread((e ntry), 0,
(arg)); (tid) =
GetCurrentThrea dId(); } while (0)
#endif

#define PORT "16001"
#define SERVER "localhost"
#define CLIENT "localhost"

#define int_error(msg) handle_error(__ FILE__, __LINE__, msg)
void handle_error(co nst char *file, int lineno, const char *msg);

void init_OpenSSL(vo id);

int verify_callback (int ok, X509_STORE_CTX *store);

long post_connection _check(SSL *ssl, char *host);

void seed_prng(void) ;

#endif /* COMMON_H */

--------------------------------------------------------------------------------
Nov 17 '05 #1
0 2011

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1177
by: Mr X | last post by:
I am getting link errors and don't understand why: - ClientClass is in Project A - NoLinkCalledClass is in Project B - Project A depends on project B - NoLinkCalledClass::NoLinkCalledClass is defined in NoLinkCalledClass.cpp
10
9502
by: Gary Hughes | last post by:
I'm getting the following error when attempting to link a managed C++ dll. I can't find any reference to these errors with google. Can anyone help? I've included the class definition causing the errors below. Everything compiles fine and all the types are defined, it appears that the template type itga::order_collection::iterator is...
7
1728
by: Kristof Thys via .NET 247 | last post by:
Post a new message to microsoft.public.dotnet.languages.vc http://www.dotnet247.com/247reference/default.aspx Hello, I've been struggling for weeks with this problem, I hope I find some help here...
1
1902
by: noleander | last post by:
I need to use a library supplied by someone else: libjpeg.lib. This is a plain C library. I do not have the source code. I do have the header *.h files. When I run dumpbin on the libjpeg.lib, it contains symbols (entry points) like: jpeg_read_header I'm trying to link my program with this library. My program is in Visual C++. The...
4
3913
by: Mike Woinoski | last post by:
(I'm new to VS, so please forgive me if this is a faq.) I'm writing some Java web services and need to test them with C++ clients. I can use either a Windows Form application or an MFC application. I used VS.NET 2003 to create a C# client that successfully processes SOAP messages to and from the Java service. However, I'm having problems with...
6
1965
by: ermanu | last post by:
Hello we don't know much about C. But we have to resolve this problem in order to work on our project. We're getting below errors whenever we try to build the code. We're trying to build the code in Visual Studio C++. Here are the errors: ------------------------------------------- test error LNK2019: unresolved external symbol...
14
1970
by: hgraham | last post by:
Hi, I'm trying to understand how to work the dom, and all I'm trying to do is insert a link right before another link in the html based on it's href value. This isn't a real world example - I'm just trying to do this in phases to understand what's going on. I'm getting an error (Object doesn't support this property or method) in IE and I...
11
11519
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the function whether i click the link then i tried this (using forms)
5
4682
by: Bruce | last post by:
I am getting a lot of link errors when compiling in the debug build but not release. I am compiling a CLR managed code class library. I believe the link errors are actually being caused by a static library of unmanagaed code. I think the problem comes from the fact that the unmanaged static lib uses the STL. Any idea how to fix this?
2
2051
by: jbanik10 | last post by:
. What errors are caught at compile time vs link time?
0
8205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.