CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Jul 2009
    Posts
    15

    Linker Tools Error LNK2005

    I have been racking my brain trying to figure out how to resolve a duplicate function error (LNK2005) and have been unsuccessful. I have followed direction on the following link as well: http://msdn.microsoft.com/en-us/libr...(v=VS.80).aspx Attached is a printscreen of where the error occurs. The following are issues I have come across:

    1. One thing I noted in the output build report is that after invoking the linker with LINK.exe, one of the linker parameters that prints is /incremental:no, though when I look under Solution Explorer\Properties\Configuration Properties\Linker\General\Enable Incremental Linking the setting is Yes(/Incremental). Is there a setting somewhere that is causing an over-ride of the setting? I have done a build/clean for the project.

    2. I have specified under Solution Explorer\Properties\Configuration Properties\Linker\Input\Ignore Specific Library the mfcs90ud.lib file. I added it back as an additional dependency. Though I still have problems with this lib file.

    Code:
    // MetaDLL_5.cpp : Defines the initialization routines for the DLL.
    //
    #pragma once
     
    #define WIN32_LEAN_AND_MEAN
    //#define _AFXDLL
    
    //#include <windows.h>
    #include "stdafx.h"
    
    #include "MetaDLL_6.h"
    #using <mscorlib.dll>
     
    using namespace System;
    using namespace System::Globalization;
    using namespace System::Runtime::InteropServices;
    using System::String;
     
    #define MT4_EXPFUNC __declspec(dllexport)
     
    #pragma managed
    String *ansi_to_managed(char *date_time)
    	{
    	return Marshal::PtrToStringAnsi(date_time);
    	}
     
    #pragma unmanaged
    BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
    	{
    	return TRUE;
    	}
     
    #pragma managed
    MT4_EXPFUNC void __stdcall gDateTime(char *date_time, int *year, int *month, int *day, int *hour, int *minute, int *second, int *millisecond)
    	{
    	
    	//String *myDateTimeValue = ansi_to_managed(date_time);	
    	String *myDateTimeValue	  = S"02/16/1992 12:15:12.253";
    	String *expectedFormats[] = {S"MM/dd/yyyy HH:mm:ss.FFF"};
    	IFormatProvider* culture = new CultureInfo(S"en_US", true);
    	DateTime myDateTime = DateTime::ParseExact(myDateTimeValue, expectedFormats, culture, DateTimeStyles::AssumeLocal);
    	
    	*year			= myDateTime.Year;
    	*month			= myDateTime.Month;
    	*day			= myDateTime.Day;
    	*hour			= myDateTime.Hour;
    	*minute			= myDateTime.Minute;
    	*second			= myDateTime.Second;
    	*millisecond	= myDateTime.Millisecond;
    	}
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured