View Full Version : SECMultiMonitor / nafxcwd.lib LINKER conflicts

03-05-2009, 04:24 PM
When I link my OT10.1 project (VS2005SP1), a list of duplicate definition errors is thrown by the linker from module (SECMultiMonitor.obj):

Error 22 error LNK2005: _g_pfnGetSystemMetrics already defined in ot1101d.lib(SECMultiMonitor.obj) nafxcwd.lib

What is causing this and how do I resolve it?
I don't need multi-monitor support - is there a way to remove this module from the OT1101d.lib library?

Thanks for any help!

03-05-2009, 07:05 PM
A follow up...

I went ahead and hand-edited the bldback80.mak file to remove the SECMultiMonitors module and I can now link my application successfully.

Is there a way to control this in the build wizard, I wonder... (I could not find a checkbox to turn off "Multi Monitor" support.)

03-06-2009, 03:27 PM
Thanks for posting your workaround. No, the BuildWizard does not provide for excluding multimonitor support, so as long as you don't need this, your approach is probably best.

I would be interested to find the underlying cause of this. If you could submit a support incident, we could investigate this further.

03-06-2009, 04:44 PM
The link error seems to point to the fact that a module within MFC's nafxcwd.lib
must already be defining the globals that SECMultiMonitor.cpp is trying to define with the COMPILE_MULTIMON_STUBS macro.
(Maybe an earlier version of Visual Studio needed this?)

So, I suspect that removing SECMultiMon.obj from my ot library build would still allow use of the multiple monitor support, although I don't actually use it.

I'll try to get time to post an incident... But for now, I was able to complete my migration from OT 6 to OT 10.1 with Visual Studio 2005SP1 making only these changes:

1. Changed the DECLARE_BUTTON macro:
class CMyComboBtn : public SECComboBtn
#if 1 // new OT v10.1 macro name
#else // old OT 6 macro name

2. Removed the 'boolean' typedef in jconfig.h, because it is already defined in the Windows header rpcnhdr.h:
#if 0
typedef unsigned char boolean;;

3. Removed the SECMultiMonitors.obj module from my OT library to fix the link error, as described above.