Try changing Item Type (in Project Properties dialog) of all .h files to “C/C++ header” (instead of “C/C++ compiler”).
LNK4042 object specified more than once; extras ignored

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
Developer technologies | C++
2 answers
Sort by: Most helpful
-
-
Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
2021-06-07T02:51:56.597+00:00 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.