Hi,
I need to get rid of this warning, how can I work out what object is specified more than once, and where, why is it happening?
The linker warning file is Application.obj
Hi,
I need to get rid of this warning, how can I work out what object is specified more than once, and where, why is it happening?
The linker warning file is Application.obj
Someone commented on another problem I'm having with VS and it made me think about the project file, and I noticed there was Win32 builds in there. So I went into configuration manager and disabled Win32 build. And that actually got rid of this linker error.
EDIT: No, this didn't actually work, it only worked for a while. VS sometimes takes several hours to update it's Intellisense database I guess, or it's just plain not understanding the source code at times, which I've seen before in C++ projects - It's pretty terrible.
Hi,
LNK4042 essentially means your linker command line has two or more .obj files that have the same name. The warning tells you that only the first one gets linked. As far as I'm concerned the solution is to manage your source code and build paths so there's only one object file with a given name in the link. For example, make sure you're not compiling both a header file and a source file with the same base name as if both were source files. Or make sure you don't have both the retail and debug intermediate directories as part of your build path at the same time.
Best Regards,
Jeanine
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.
Try changing Item Type (in Project Properties dialog) of all .h files to “C/C++ header” (instead of “C/C++ compiler”).
Thanks! You made my day (night actually).
I wouldn't think of it. I guess that I just misclicked when creating the project.
I had a bigger problem. Sometimes there were linker errors that objects in the said .obj were missing.
Until now I was just adding or deleting a blank line in the .cpp file and it worked (I understood that I thus forced a compile which resolved the references).
8 people are following this question.