By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,301 Members | 1,456 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,301 IT Pros & Developers. It's quick & easy.

Visual C++ 6.0 DLL with MFC

P: 5
I am trying to build a DLL that uses the CString class. If I create a sample dll (that exports symbols), set project settings to indicate that I want to Use MFC in a Shared DLL, add

CString c;

to the sample method, and build, I get ...

error C2065: 'CString' : undeclared identifier

If I remove #include <windows.h> and add #include <afxwin.h> to the StdAfx.h file, in the indicated place, I get ...

error LNK2005: _DllMain@12 already defined in sample.obj

I am at a loss ... Help!

Todd
Mar 14 '07 #1
Share this Question
Share on Google+
1 Reply


sicarie
Expert Mod 2.5K+
P: 4,677
I am trying to build a DLL that uses the CString class. If I create a sample dll (that exports symbols), set project settings to indicate that I want to Use MFC in a Shared DLL, add

CString c;

to the sample method, and build, I get ...

error C2065: 'CString' : undeclared identifier

If I remove #include <windows.h> and add #include <afxwin.h> to the StdAfx.h file, in the indicated place, I get ...

error LNK2005: _DllMain@12 already defined in sample.obj

I am at a loss ... Help!

Todd
I think you're trying to use a C String. If I'm wrong, please ignore me, otherwise, you need to make sure you have string.h included, and from there, I believe the declaration is just 'string stringVarName'.
Mar 15 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.