Puzzling project/solution setup in VS.net

Started by
2 comments, last by rileyriley 20 years, 3 months ago
I have my program split up into several projects within the same solution in VS.net (C++). There is a "main" project that lists the other projects as its dependencies. For example, I have a graphics project and a math project, and they both feed into the main project. The main project outputs an executable, and the other projects output libraries in .lib form. The problem comes when I want to use an additional library that I did not write (for example, d3d9.lib). To use them, I go to the particular project that needs them and add them to the particular project's 'Additional Dependencies' property, and that is all. Then, when I try to build the solution, I get a long list of warnings about redefinitions. For example: d3d9.lib(d3d9.dll) : warning LNK4006: _Direct3DCreate9@4 already defined in d3d9.lib(d3d9.dll); second definition ignored I get one of those for every function in the library. This happens whether I build the entire solution or just the one project. Does anyone know why this might be happening? Thanks for any insight~ edit: PS: I have checked everywhere for somewhere I might have required the library twice.. in each case, I only add the library to one dependency list! [edited by - rileyriley on January 14, 2004 7:55:21 PM]
--Riley
Advertisement
If I understand your problem, then I would say that you shouldn''t link against d3d9.lib in your libraries. Only do it in your main project.
Thanks, that works perfectly. I guess I don''t quite understand how the project heirarchy goes yet.


Now I''m getting
LINK : warning LNK4098: defaultlib ''LIBC'' conflicts with use of other libs; use /NODEFAULTLIB:library
when I build the main project, but I''ll work on figuring that out for a while. Thanks for the help.
--Riley
That one sounds like you''ve got conflicting runtime library settings in the different libraries and the main project. Make sure the the Runtime Library setting on all the projects are the same. Should be under project options->C/C++->Code Generation.

This topic is closed to new replies.

Advertisement