conflict between ATL and MFC
-
I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd
-
I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd
As I understand it, MFC does not mix too well with ATL. I've read that it's OK to use ATL in MFC but not so good the other way round. Though in VC7 there are now a number of shared classes. Plus ATL has its own collection classes. If you're using VC7 why not investigate CAtlMap? If you're using VC6 try STL map. Of course this may not be feasible if, as it seems, you have a lot of old code that uses CMap. Kevin
-
I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd
If you are using VC7 you can check "Support for MFC" when you create a new ATL project. Unfortunately I don't really know what it does, so I can't help you changing the settings on your current project. -- Denn du bist, was du isst! Und ihr wisst, was es ist! Es ist mein Teil...?
-
I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd
I was once asked to look at why a process was taking a long time to accomplish a task. One thing the process did was load a large number of entries into a CMap. I did a bit of experimentation, and found that inserting 300,000 entries into a CMap took a bit over 4 hours. Doing 300,000 lookups on the CMap also took a bit over 4 hours. I tried an STL map, and found that inserting 300,000 entries took 22 seconds, and looking up 300,000 entries took 19 seconds. I've never had any use for CMaps. If you can, you might try switching to an STL map.
-
I was once asked to look at why a process was taking a long time to accomplish a task. One thing the process did was load a large number of entries into a CMap. I did a bit of experimentation, and found that inserting 300,000 entries into a CMap took a bit over 4 hours. Doing 300,000 lookups on the CMap also took a bit over 4 hours. I tried an STL map, and found that inserting 300,000 entries took 22 seconds, and looking up 300,000 entries took 19 seconds. I've never had any use for CMaps. If you can, you might try switching to an STL map.
Wow! That's a huge difference! Nowadays I go for STL first with new MFC code. Not that I get to do much new MFC code these days. Though sometimes, depending on the context, the MFC stuff can be more convenient, e.g., CString. Kevin