Hi DaniWeb Team,
I have just finished to read all about CString in the web, topic since 98 to 2009
CString is extict because it is from MFC which is extinct, ... and if i need to use CString? i found macro that import CString MFC to ATL but this work with older version of Visual Studio than mine, now i'm using VS.net 2003 " http://www.codeguru.com/cpp/com-tech/atl/atl/article.php/c67 ".
i can't understand how to resolve this problem.
i have #included "atlstr.h" and ignoring the follow specific library "MSVCRT.lib;msvcprt.lib". I know that this is not the correct solution but i don't know how to set header, library to resolve this tedium
now i see these errors:

Encode error LNK2020: unresolved token (0A0000AB) __imp_?npos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@2IB
Encode error LNK2020: unresolved token (0A0000AF) __imp_?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2IB
Encode error LNK2020: unresolved token (0A0000B2) __imp_cerr
Encode error LNK2020: unresolved token (0A0000B4) __imp_cout
Encode fatal error LNK1120: 4 unresolved externals
Encode warning LNK4049: locally defined symbol ?id@?$ctype@D@std@@2V0locale@2@A (public: static class std::locale::id std::ctype<char>::id) imported
Encode warning LNK4049: locally defined symbol ?id@?$ctype@D@std@@2V0locale@2@A (public: static class std::locale::id std::ctype<char>::id) imported
Encode warning LNK4049: locally defined symbol ?id@?$ctype@G@std@@2V0locale@2@A (public: static class std::locale::id std::ctype<unsigned short>::id) imported
Encode warning LNK4049: locally defined symbol ?id@?$ctype@G@std@@2V0locale@2@A (public: static class std::locale::id std::ctype<unsigned short>::id) imported

thanks for any suggestions

Hi Maudits,

By looking at the error, it seems like a problem with the library includes. The function body is not being found. Please include the necessary library files. Or you could even try to shift the function body within the class in case you are using templates.

I hope this solves your problem. In case it doesnt then please pass the entire solution code to me.

Best Regards,
Rajshree

Hi everybody,

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

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

these are 2 damn errors. About the second, i wonder if i mixed MFC and ATL included:

#include "stdafx.h"
#include "afx.h"
//#include <atlstr.h> //it's commented, i'm doing some test
//#using <mscorlib.dll> //is it useful?
#include "types.h"
#include "Socket.h"
#include <iostream>
#include "md5sum.h"

I'm using VC++ '03 so i think there aren't problems if i used MFC objects like CString but which is the good configuration of VC++, headers & library?
In "Project->Properties->General->Use of MFC or Use of ATL" what should i configure these options?

About the second i have a question. I have included md5sum.h, i wonder why VC++ wants a .lib for "MD5Sum::Calculate(unsigned char const *,unsigned int)". i have just controlled if i mistake some parameters but i didn't. it seems like hasn't the implementation of this function in md5sum.cpp.
thanks a lot for any help
greets

Is the only reason you are using MFC is to get CString class? If yes then why don't you dump MFC and use <string> instead? The only advantage that CString has over <string> is its Format() method, which is more like sprintf().

opic since 98 to 2009
CString is extict because it is from MFC which is extinct,

I don't know (or care) who told you that but it isn't true. VC++ 2010 still supports MFC.

commented: solid advice. +24

i'm using CString because i'm forced to use it. i must use some functions already implemented with CString such as md5sum. CString is very useful when you want to convert for ex. uchar to integer.
i'm confused about
which CString implementation(MFC or ATL)should i choose and which setting should i do?

if i have created a project like Console Application(.NET), is it possible to use CString? i have saw in "project properties -> Conf Propert -> General" the fields "Use of MFC" & "Use of ATL", so can i implement CString?

If you are using managed extensions then it is possible to use CString in .NET console application by including atlstr header file like this:-

#include <atlstr.h>

There is not need to add support for MFC or ATL.

Hope this helps.

Cheers

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.