Click here to Skip to main content
15,906,626 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
RKP72823-Apr-09 19:26
RKP72823-Apr-09 19:26 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
Stuart Dootson23-Apr-09 20:06
professionalStuart Dootson23-Apr-09 20:06 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
RKP72823-Apr-09 22:06
RKP72823-Apr-09 22:06 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
Stuart Dootson23-Apr-09 22:18
professionalStuart Dootson23-Apr-09 22:18 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
RKP72824-Apr-09 0:11
RKP72824-Apr-09 0:11 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
Stuart Dootson24-Apr-09 1:16
professionalStuart Dootson24-Apr-09 1:16 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
RKP72824-Apr-09 1:53
RKP72824-Apr-09 1:53 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
Stuart Dootson24-Apr-09 3:23
professionalStuart Dootson24-Apr-09 3:23 
rupeshk_p wrote:
The libcmtd.lib of both VS2003 and VS2008 has the definitions of strtoul.
But the build fails in VS2008.


That is because the VS2008 build pulls in strtol.obj out of libcmtd.lib (that's what libcmtd.lib(strtol.obj) means), whereas the VS2003 build doesn't.

Object code libraries aren't really single units - they're a bit like zip files, in that they're made up of lots of different files internally. What this means is that if nothing requires a symbol that is only found in libcmtd.lib(strtol.obj), libcmtd.lib(strtol.obj) will not be looked at by the linker. This is what happens with the VS2003 build.

The VS2008 build, however, needs a definition of _strtol - that must have been added to the C run-time somewhere. Now, _strtol is only found in libcmtd.lib(strtol.obj). So, the linker adds the object file libcmtd.lib(strtol.obj) to the build. However, when it then comes to tie all the object files together, it finds two definitions of _strtoul - the one in libcmtd.lib(strtol.obj) and the one in your code. It does not (cannot) know which to use, so it raises a fatal error.

rupeshk_p wrote:
Does /MT or /Mtd option of linking has anything to do with this error?


I doubt it, but you could try.

What you have encountered however, is the reason that you shouldn't do things like redefine standard functions - some completely unrelated change in the Microsoft libraries has broken your build!

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
RKP72824-Apr-09 22:09
RKP72824-Apr-09 22:09 
GeneralRe: libcmtd.lib(strtol.obj) : error LNK2005: strtoul already defined in . . . Pin
RKP72826-Apr-09 21:32
RKP72826-Apr-09 21:32 
QuestionHow to implement CCrypto class into a MDI project ? Pin
mesajflaviu23-Apr-09 1:46
mesajflaviu23-Apr-09 1:46 
AnswerRe: How to implement CCrypto class into a MDI project ? Pin
Iain Clarke, Warrior Programmer23-Apr-09 2:10
Iain Clarke, Warrior Programmer23-Apr-09 2:10 
GeneralRe: How to implement CCrypto class into a MDI project ? Pin
mesajflaviu23-Apr-09 8:35
mesajflaviu23-Apr-09 8:35 
GeneralRe: How to implement CCrypto class into a MDI project ? Pin
Iain Clarke, Warrior Programmer24-Apr-09 5:54
Iain Clarke, Warrior Programmer24-Apr-09 5:54 
GeneralRe: How to implement CCrypto class into a MDI project ? Pin
mesajflaviu25-Apr-09 6:56
mesajflaviu25-Apr-09 6:56 
GeneralRe: How to implement CCrypto class into a MDI project ? [modified] Pin
mesajflaviu3-May-09 20:35
mesajflaviu3-May-09 20:35 
QuestionHow to load a region from an image file? Pin
Frank Isensee23-Apr-09 0:46
Frank Isensee23-Apr-09 0:46 
AnswerRe: How to load a region from an image file? Pin
CPallini23-Apr-09 1:40
mveCPallini23-Apr-09 1:40 
AnswerRe: How to load a region from an image file? Pin
Hamid_RT23-Apr-09 2:54
Hamid_RT23-Apr-09 2:54 
QuestionIs there any function similiar to CopyImage () (in Visual C++) that is supported in Embedded Visual C++? Pin
kapardhi23-Apr-09 0:39
kapardhi23-Apr-09 0:39 
QuestionRe: Is there any function similiar to CopyImage () (in Visual C++) that is supported in Embedded Visual C++? Pin
CPallini23-Apr-09 1:42
mveCPallini23-Apr-09 1:42 
AnswerRe: Is there any function similiar to CopyImage () (in Visual C++) that is supported in Embedded Visual C++? Pin
kapardhi23-Apr-09 1:58
kapardhi23-Apr-09 1:58 
GeneralRe: Is there any function similiar to CopyImage () (in Visual C++) that is supported in Embedded Visual C++? Pin
CPallini23-Apr-09 2:11
mveCPallini23-Apr-09 2:11 
AnswerRe: Is there any function similiar to CopyImage () (in Visual C++) that is supported in Embedded Visual C++? Pin
Rajkumar R23-Apr-09 2:02
Rajkumar R23-Apr-09 2:02 
QuestionFullscreen blocks autohide Taskbar Pin
baerten23-Apr-09 0:24
baerten23-Apr-09 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.