المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Duplicate Function - Linker Error LNK2005



C++ Programming
04-03-2012, 02:00 AM
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/library/72zdcz6f(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.

// MetaDLL_5.cpp : Defines the initialization routines for the DLL.//#pragma once #define WIN32_LEAN_AND_MEAN//#define _AFXDLL//#include #include "stdafx.h"#include "MetaDLL_6.h"#using using namespace System;using namespace System::Globalization;using namespace System::Runtime::InteropServices;using System::String; #define MT4_EXPFUNC __declspec(dllexport) #pragma managedString *ansi_to_managed(char *date_time) { return Marshal::PtrToStringAnsi(date_time); } #pragma unmanagedBOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return TRUE; } #pragma managedMT4_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; }