hi everybody,
I am blocked on a strange error. I need to use md5sum library. Visual c++ can read md5sum.h but it throws some errors when tries to compile it, it seems that visual c doesn't identify md5sum.cpp where constructors and functions are declared. I have already changed include library options.
i'm using more than this library for example crypto51 but this doesn't gives me any problem, even if it's equal formed by .h & .cpp for every library.
Some suggestion?
tnx 4 any help
francesco

Lol sometimes you use "VISUAL C" and in other cases "VISUAL C++" which one are you using ?

> throws some errors
Pasting your actual error messages as well would likely help as well.

encryption error LNK2001: unresolved external symbol "public: __thiscall MD5Sum::MD5Sum(unsigned char const *,unsigned int)" (??0MD5Sum@@$$FQAE@PBEI@Z)

encryption error LNK2001: unresolved external symbol "public: class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > __thiscall MD5Sum::Calculate(unsigned char const *,unsigned int)" (?Calculate@MD5Sum@@$$FQAE?AV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@PBEI@Z)

encryption error LNK2001: unresolved external symbol "struct RC4_Key_Struct * __cdecl RC4CreateKey(unsigned char const *,unsigned int,struct RC4_Key_Struct *,bool)" (?RC4CreateKey@@$$FYAPAURC4_Key_Struct@@PBEIPAU1@_N@Z)

i don't like what these messages say!
these are my errors, start with a coffee

encryption error LNK2001: unresolved external symbol "public: __thiscall MD5Sum::MD5Sum(unsigned char const *,unsigned int)" (??0MD5Sum@@$$FQAE@PBEI@Z)

encryption error LNK2001: unresolved external symbol "public: class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > __thiscall MD5Sum::Calculate(unsigned char const *,unsigned int)" (?Calculate@MD5Sum@@$$FQAE?AV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@PBEI@Z)

encryption error LNK2001: unresolved external symbol "struct RC4_Key_Struct * __cdecl RC4CreateKey(unsigned char const *,unsigned int,struct RC4_Key_Struct *,bool)" (?RC4CreateKey@@$$FYAPAURC4_Key_Struct@@PBEIPAU1@_N@Z)

i don't like what these messages say!
these are my errors, start with a coffee

When you get an 'unresolved external symbol' linker error it means that your linker was unable to find the library where the object referred to in the error message is defined.

In a very general fashion, what's happening when you build your project is:
Your compiler is finding the appropriate header file/s for MD5Sum and is compiling your code with no errors, but because the linker doesn't know where the MD5Sum library is, the link part of the build process is failing and throwing errors

What you need to do is alter your compilers settings so that it knows where to find the appropriate header and libary files for the MD5Sum library.

You might want to take a look at this thread I posted yesterday for starters...It explains how to register additional include/library paths in VS:
http://www.daniweb.com/forums/thread198756.html

Note: The library I posted instructions for yesterday was a completely different library (I.e. Not MD5Sum) but the process itself will be exactly the same.

Anyways, I hope that is of some help!
Cheers for now,
Jas.

P.S. To all the Admins on this forum...Would it be worth somebody posting a sticky/tutorial on link errors/registering additional headers/libs with visual studio? There seem to be quite a few people posting similar threads to this..I think it's the third or fourth I've come across recently!

I have already changed include library options.

Sorry, I didn't notice that in the OP.

If you have definitely got the paths to the lib/header folders set up properly in VS (best double check it to make sure!), then it is one of two things as far as I see it:

1. The order of the additional libraries/includes - perhaps try making it so that MD5Sum is the 1st entry in the list of additional libs and additional headers..Sometimes the order of the additional includes/libs is important because some libs may depend on other libs to be present.

Otherwise:

2. Please don't get angry with me for suggesting this but...
I just realised...My previous post assumed that you already had the prebuilt libs/dlls for the MD5Sum library..

However, if you downloaded a source package for this library, it is possible that you may need to build the library before you can use it in your own project.

A lot of cross-platform libs especially those that originated on *nix usually only come with source and makefiles (and sometimes VC project files if you're lucky!) but not the binaries.

So that could be the other problem...Maybe you've got VS set up correctly, but you just don't have the binaries for the library because you haven't built them yet!

It's ok to admit it, it's happened to me in the past! I downloaded a library once a few years ago. I unzipped it, altered my include/library paths, wrote some code, compiled and then...Doh! linker errors....
A quick peek in the lib folder of the library showed that there was no lib in there. It was completely empty...Feeling like a complete doughnut I then opened up the source for the lib and built it. I recompiled my own code and then....Phew! It built and linked succesfully!

These are the only other explanations I can think of for the linker errors you're getting!
Cheers for now,
Jas.

Tnx for your interest guys, tnx jason for your suggestions. i have appreciate them.
So i followed your suggestion i'm trying to compile md5sum, and i have some error also here :-P, i have solved part of these, adding
afx.h, but this solution throws 2 errors:

md5sum error LNK2019: unresolved external symbol __beginthreadex referenced in function "public: int __thiscall CWinThread::CreateThread(unsigned long,unsigned int,struct _SECURITY_ATTRIBUTES *)" (?CreateThread@CWinThread@@QAEHKIPAU_SECURITY_ATTRIBUTES@@@Z)

md5sum error LNK2019: unresolved external symbol __endthreadex referenced in function "void __stdcall AfxEndThread(unsigned int,int)" (?AfxEndThread@@YGXIH@Z)

i need to include afx.h otherwise the declaration of md5sum gives me errors with Cstring in:
MD5Sum(const CString &sSource);

and with other constructors that use CString type.
i found this solution doing googgling.
So, another link problem, again...wow

francesco

i would like to reset this thread...
i have the same problem with md5sum, but not with link errors,i understood the meaning of link errors, but now the problem is not the link error.

so, the errors are these:

MD5Sum.h(29): error C2226: syntax error : unexpected type 'MD5Sum'
MD5Sum.h(29): error C2238: unexpected token(s) preceding ';'
MD5Sum.h(32): error C2143: syntax error : missing ',' before '&'
MD5Sum.h(32): error C2146: syntax error : missing ';' before identifier 'Calculate'
MD5Sum.h(32): error C2501: 'MD5Sum::CString' : missing storage-class or type specifiers

i have added to my Visual C++ solution md5sum.h and md5sum.cpp.

it seems the case of a missing library. but which one? i can't find any particular library to include md5sum.

compiler gives me errors about a declaration of md5sum constructor and functions in the header file.

this is the common md5sum.h:

class MD5Sum
{
public:
    MD5Sum();
    MD5Sum(const CString& sSource);
    MD5Sum(const unsigned char* pachSource, uint32 nLen);

    CString Calculate(const CString& sSource);
        ....

i'm seeing implementations of md5sum on google but nothing is different from mine.
any suggestions?
thanks a lot for any help

OK SOLVED!
The problem was CString that needs to include afx.h.
afx and stdafx headers are different, i have both included.
i read this solution on another topic in this forum. Thanks.
these are part of MFC environment(visual C/C++, ...).

No i was joking :(
who explain to me why if i add md5sum.h and md5sum.cpp in my project solution the compiler expoding with some errors about anything is present on thr file?

so now i haven't any compiler errors, but LNK errors. i'm looking for a .lib. Someone has any idea about what library md5sum needs?
tnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.