Link to home
Start Free TrialLog in
Avatar of marti23esp
marti23esp

asked on

Trying to use COLEVariant to save a Variant type in a string way

Hello!
I am trying to use COLEVariant to deal with one propietary .dll with a COM object.
The line I want to use is that...

hr=(m_pIFeature[iFeature])->Similarity(COleVariant(COleVariant(vArg2)).Detach(),&poSimilarity1);

The important thing is to use COleVariant I need to include...
#include "afxdisp.h"

I tried to include also...
#include "StdAfx.h"

The thing is the linking errors are...
Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmtd.lib(delop.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __cinit already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __cexit already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Exit_Done already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Termination_Done already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exitflag already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wpgmptr already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __pgmptr already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___winitenv already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wenviron already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___initenv already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __environ already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___wargv already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argv already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argc already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winminor already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winmajor already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winver already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __osver already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __umaskval already defined in LIBCMTD.lib(crt0dat.obj)
LIBC.lib(cfout.obj) : error LNK2005: ___dtold already defined in LIBCMTD.lib(cfout.obj)
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
Win32Debug/cs.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

cs.exe - 26 error(s), 1 warning(s)

and I tried to exclude libcmtd.lib but that just doesn´t work.

Any idea?
Avatar of marti23esp
marti23esp

ASKER

I just changed Project Settings -> Category -> Code Generation-> Use run time library to Multithreaded and I4ve got more problems than before...
Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMT.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmtd.lib(delop.obj)
libcmtd.lib(dbgheap.obj) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
libcmtd.lib(dbgheap.obj) : error LNK2005: __nh_malloc already defined in LIBCMT.lib(malloc.obj)
libcmtd.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
libcmtd.lib(dbgheap.obj) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)
libcmtd.lib(dbgheap.obj) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
libcmtd.lib(dbgheap.obj) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
libcmtd.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: __get_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: __set_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_heap_init already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_find_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_free_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_region already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_group already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_resize_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_heapmin already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___sbh_heap_check already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: __get_old_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: __set_old_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_new_region already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_release_region already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_decommit_pages already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_find_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_free_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_alloc_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_alloc_block_from_page already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_resize_block already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_heap_check already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
libcmtd.lib(sbheap.obj) : error LNK2005: ___old_small_block_heap already defined in LIBCMT.lib(sbheap.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __cinit already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __cexit already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Exit_Done already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Termination_Done already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exitflag already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wpgmptr already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __pgmptr already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___winitenv already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wenviron already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___initenv already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __environ already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___wargv already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argv already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argc already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winminor already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winmajor already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winver already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __osver already defined in LIBCMT.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __umaskval already defined in LIBCMT.lib(crt0dat.obj)
LINK : warning LNK4098: defaultlib "libcmtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
Win32Debug/cs.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

cs.exe - 56 error(s), 2905 warning(s)
I find that...
http://support.microsoft.com/default.aspx?scid=KB;en-us;q148652

but I still have the problem with libc.lib

Somebody here outside can help me with that?

It seems visual C++ don´t want to get rid of that ****ing library. And It should be important because I also tried to delete it.

I am a desesperated man ;)
Hi!
try to use MFC DLL + CRT Muiltithread DLL
Hi!
try to use MFC DLL + CRT Muiltithread DLL
---
I just tried that and I had more problems than before.
ok
what libraries you use?
can you show your DSP file - just part of them -
from line:
!IF  "$(CFG)" == "... Debug"
and up to line
!ELSEIF
or
!ENDIF
Here it is
!ELSEIF  "$(CFG)" == "cs - Win32 Debug"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Win32Debug"
# PROP Intermediate_Dir "Win32Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /ZI /Od /I "." /I "Base" /I "BundleBlock" /I "Exceptions" /I "Image" /I "ImExport" /I "Install" /I "Matching" /I "Matching\KLT_Matching" /I "Matching\KLT_Matching\track" /I "Matching\Inria_Matching" /I "Matching\Dense_Matching" /I "Matrix" /I "Matrix\NumericalRecipes\Mathematica" /I "Matrix\NumericalRecipes\math_math" /I "Matrix\NumericalRecipes\Ice" /I "Orientation" /I "Primitives" /I "Repository" /I "Segmentation" /I "Segmentation/GAR" /I "Segmentation/qts_masking" /I "Semantic" /I "StartOrientation" /I "Texture" /I "Topology" /I "Transformation" /I "UserInterface" /I "UserInterface\AttributeViews" /I "UserInterface\Controler" /I "UserInterface\Widgets" /I "Version" /I "FastVision" /I "FastVision\FastVisionLib" /I "MarchingCube" /I "Delaunay" /I "Delaunay\detri" /I "Matrix\NumericalRecipes" /I "SelfCalibration" /D "_DEBUG" /D "USE_LUG_LIB" /D "WIN32" /D "_WINDOWS" /D "USE_EXCEPTIONS" /D "NRANSI" /D "USE_OBSERVER" /Fr /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libci.lib opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib imm32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib qt.lib liblug.lib libjpeg.lib libtiff.lib mat_math.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib libcid.lib libc" /out:"Win32Debug/cs.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
---
My last try with that configuration file give me the errors attached at the final of this document.
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Win32Debug"
# PROP Intermediate_Dir "Win32Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /ML /W3 /GX /ZI /Od /I "." /I "Base" /I "BundleBlock" /I "Exceptions" /I "Image" /I "ImExport" /I "Install" /I "Matching" /I "Matching\KLT_Matching" /I "Matching\KLT_Matching\track" /I "Matching\Inria_Matching" /I "Matching\Dense_Matching" /I "Matrix" /I "Matrix\NumericalRecipes\Mathematica" /I "Matrix\NumericalRecipes\math_math" /I "Matrix\NumericalRecipes\Ice" /I "Orientation" /I "Primitives" /I "Repository" /I "Segmentation" /I "Segmentation/GAR" /I "Segmentation/qts_masking" /I "Semantic" /I "StartOrientation" /I "Texture" /I "Topology" /I "Transformation" /I "UserInterface" /I "UserInterface\AttributeViews" /I "UserInterface\Controler" /I "UserInterface\Widgets" /I "Version" /I "FastVision" /I "FastVision\FastVisionLib" /I "MarchingCube" /I "Delaunay" /I "Delaunay\detri" /I "Matrix\NumericalRecipes" /I "SelfCalibration" /D "_DEBUG" /D "USE_LUG_LIB" /D "WIN32" /D "_WINDOWS" /D "USE_EXCEPTIONS" /D "NRANSI" /D "USE_OBSERVER" /Fr /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 nafxcwd.lib  libcmtd.lib opengl32.lib glu32.lib imm32.lib wsock32.lib qt.lib liblug.lib libjpeg.lib libtiff.lib mat_math.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd.lib libc.lib" /out:"Win32Debug/cs.exe" /pdbtype:sept /verbose:lib
# SUBTRACT LINK32 /pdb:none /nodefaultlib
---
Searching Libraries
    Searching E:\Program\Microsoft Visual Studio\VC98\MFC\LIB\nafxcwd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libcmtd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\opengl32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\glu32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\imm32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\wsock32.lib:
    Searching \\Pc259\Server1\Src\qt-2.20\lib\qt.lib:
    Searching \\Pc259\Server1\Src\lug\lib\liblug.lib:
    Searching \\Pc259\Server1\Src\jpeg-6a\lib\libjpeg.lib:
    Searching \\Pc259\Server1\Src\tiff-v3.4\lib\libtiff.lib:
    Searching \\Pc259\Server1\Src\mat_math\lib\mat_math.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\kernel32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\user32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\gdi32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\winspool.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\comdlg32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\advapi32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\shell32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\ole32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\oleaut32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\uuid.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\odbc32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\odbccp32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libcpmtd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\OLDNAMES.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libcimtd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\comctl32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\oledlg.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\olepro32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\urlmon.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\wininet.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\imagehlp.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libc.lib:
libc.lib(crt0dat.obj) : error LNK2005: __cinit already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: _exit already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __exit already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __cexit already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __C_Exit_Done already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __C_Termination_Done already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __exitflag already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __wpgmptr already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __pgmptr already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: ___winitenv already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __wenviron already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: ___initenv already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __environ already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: ___wargv already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: ___argv already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: ___argc already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __winminor already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __winmajor already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __winver already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __osver already defined in libcmtd.lib(crt0dat.obj)
libc.lib(crt0dat.obj) : error LNK2005: __umaskval already defined in libcmtd.lib(crt0dat.obj)
libc.lib(cfout.obj) : error LNK2005: ___dtold already defined in libcmtd.lib(cfout.obj)
    Searching E:\Program\Microsoft Visual Studio\VC98\MFC\LIB\nafxcwd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libcmtd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\opengl32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\glu32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\imm32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\wsock32.lib:
    Searching \\Pc259\Server1\Src\qt-2.20\lib\qt.lib:
    Searching \\Pc259\Server1\Src\lug\lib\liblug.lib:
    Searching \\Pc259\Server1\Src\jpeg-6a\lib\libjpeg.lib:
    Searching \\Pc259\Server1\Src\tiff-v3.4\lib\libtiff.lib:
    Searching \\Pc259\Server1\Src\mat_math\lib\mat_math.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\kernel32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\user32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\gdi32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\winspool.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\comdlg32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\advapi32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\shell32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\ole32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\oleaut32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\uuid.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\odbc32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\odbccp32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libcpmtd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\OLDNAMES.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libcimtd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\comctl32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\oledlg.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\olepro32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\urlmon.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\wininet.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\imagehlp.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libc.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\MFC\LIB\nafxcwd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\libcmtd.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\opengl32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\glu32.lib:
    Searching E:\Program\Microsoft Visual Studio\VC98\LIB\imm32.lib:
Done Searching Libraries
libcmtd.lib(crt0init.obj) : warning LNK4098: defaultlib "libc.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
Win32Debug/cs.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Hi!
your project have
/subsystem:console
and
/subsystem:windows

What type of Project you build GUI or console?????

typical settings for MFC app is:

/D "_AFXDLL"
and only /subsystem:windows or /subsystem:console not both
so try add
this define in the C++ tab and replace /sybsistem:console in the Linker tab to the :windows one!
Hi miqel thanks for your help.
I am just not doing any MFC application instead of that I am using QT library to do a GUI application. That´s the reason of /D "_AFXDLL". The problem is that I have to deal with COM components and at the same time deal with a lot of code that is older and maybe wouldn´t work too much good with libcmtd.lib(multithread libraries)

I really don´t know how to solve that. But mainly I think I can´t compile the older code because goes with libc.lib and the new code needs libcmtd.lib so it´s imposible to link together that two codes.

Actually I am thinking some way to getting rid of the older code. If you have any other idea please tell me.
Thanks for your help.
Sorry I made one mistake with the former note. Too much hours in front of a computer couldn´t be good at all.

I am just not doing any MFC application instead of that I am using QT library to do a GUI application. That´s the reason of /subsystem:console. The problem is that I have to deal with COM components and at the same time deal with a lot of code that is older and maybe wouldn´t work too much good with libcmtd.lib(multithread libraries)

I really don´t know how to solve that. But mainly I think I can´t compile the older code because goes with libc.lib and the new code needs libcmtd.lib so it´s imposible to link together that two codes.

Actually I am thinking some way to getting rid of the older code or a way to don´t use COleVariant class to save my variant data. If you have any other idea please tell me.
Thanks for your help.

Ok
whay you don`t use MSVC runtime OLE/COM support that is:
_varaint_t ?
for example:
#include <comdef.h>
hr=(m_pIFeature[iFeature])->Similarity(COleVariant(_variant_t(vArg2)).Detach(),&poSimilarity1);

to use this class you must remove nafxcwd.lib from link settings
That´s a good try I supose but it didn´t work...

e:\marti\myprojects\mbaproject28102002\neu\imagefeat.cpp(766) : error C2065: 'COleVariant' : undeclared identifier
e:\marti\myprojects\mbaproject28102002\neu\imagefeat.cpp(766) : error C2065: '_variant_' : undeclared identifier
e:\marti\myprojects\mbaproject28102002\neu\imagefeat.cpp(766) : error C2228: left of '.Detach' must have class/struct/union type
e:\marti\myprojects\mbaproject28102002\neu\imagefeat.cpp(766) : error C2143: syntax error : missing ')' before ';'
sorry lost one of :-))
COleVariant must be replaced by _variant_t
#include <comdef.h>
hr=(m_pIFeature[iFeature])->Similarity(_variant_t(_variant_t(vArg2)).Detach(),&poSimilarity1);

also do you include comdef.h ?????
I think its comutil.h
ASKER CERTIFIED SOLUTION
Avatar of migel
migel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
okey Miqel what you said is right. Thank you very much.
Now I will try to work with that. My task is to save a variant type in an xml file. I was looking in _variant_t help but I didn´t find nothing useful until now. Tomorrow I will look further but anyone has a code to do that.
It doesn´t matter which kind of file format will be the saved file. I just need to be able to reconstruct the variant type. I just don´t have enough points to make that question but if that doesn´t take much time to you it will save a lot of my time.
Hi!
_varaiant_t have many type cast operators

     operator short() const throw(_com_error);               // Extracts a short from a VT_I2
     operator long() const throw(_com_error);               // Extracts a long from a VT_I4
     operator float() const throw(_com_error);               // Extracts a float from a VT_R4
     operator double() const throw(_com_error);               // Extracts a double from a VT_R8
     operator CY() const throw(_com_error);                    // Extracts a CY from a VT_CY
     operator _bstr_t() const throw(_com_error);               // Extracts a _bstr_t from a VT_BSTR
     operator IDispatch*() const throw(_com_error);          // Extracts a IDispatch* from a VT_DISPATCH
     operator bool() const throw(_com_error);               // Extracts a bool from a VT_BOOL
     operator IUnknown*() const throw(_com_error);          // Extracts a IUnknown* from a VT_UNKNOWN
     operator DECIMAL() const throw(_com_error);               // Extracts a DECIMAL from a VT_DECIMAL
     operator BYTE() const throw(_com_error);               // Extracts a BTYE (unsigned char) from a VT_UI1

so you can cast it to the _bstr_t type (BSTR 'native' OLE type C++ wrapper) and than cast to the char* or wchar*
for example:
// you have VARIANT (VAR) that holds BSTR
_variant_t var(VAR);
_bstr_t bstrName = var;
char* szName = bstrName;
That last didn´t works good but thanks for the help it seems the rebuilded VARIANT object doesn´t seems to be rebuilded fine.


               if( SUCCEEDED( (m_pIFeature[iFeature])->Extract( nWidth[iNumFiles], nHeight[iNumFiles], vArg ))) {
             
                         VARIANT vArg2;
                         VariantInit( &vArg2 );
                         if( SUCCEEDED( (m_pIFeature[iFeature])->Descriptor( &vArg2 ))) {

                         _variant_t var(vArg2);
                         _bstr_t    bstrVariant = var;
                         char*      szName = bstrVariant;
                         QDomText   tMagicNum=doc->createTextNode(szName);
                         
                         hr=(m_pIFeature[iFeature])->Similarity(_variant_t(_variant_t(bstrVariant)).Detach(),&poSimilarity1);

I tested with similarity method, if the descriptor was extracted from the object should return a double poSimilarity.

It works with vArg2 but not with variant_t(_variant_t(bstrVariant)).Detach()          
                         
Hi
why you use double casting????
simle wrote
hr=(m_pIFeature[iFeature])->Similarity(&_variant_t(bstrVariant), &poSimilarity1);
since _varaint_t simple extends VARIANT type.

That code...

  hr=(m_pIFeature[iFeature])->Similarity(_variant_t(bstrVariant).Detach(),&poSimilarity1);

mmmm... That doesn´t make any difference sorry.

and the other code...
hr=(m_pIFeature[iFeature])->Similarity(&_variant_t(bstrName),&poSimilarity1);

give that error...
E:\marti\MyProjects\MBAProject28102002\neu\imageFeat.cpp(671) : error C2664: 'Similarity' : cannot convert parameter 1 from 'class _variant_t *' to 'struct tagVARIANT'
        No constructor could take the source type, or constructor overload resolution was ambiguous

Thanks to try.
so just remove & sign
hr=(m_pIFeature[iFeature])->Similarity(_variant_t(bstrName),&poSimilarity1);
That last doesn´t give the result expected :(