VS2008 - Project items with same name

Started by
5 comments, last by Nitage 14 years, 3 months ago
Hey guys, So I have a VS2008 project with several folders to keep things tidy. Each project folder stores its item files in a separate directory on my HDD. My problem is that I have two different items called "Functions.cpp" in two different project folders, and of course, in two different folders on my HDD. Now when I compile, these two items fight to have their "Functions.obj" file in the build folder, so to combat that I changed one of the items to compile under a different object name instead. When building I get a linker error because for some reason only one of the OBJ files get linked. The obvious solution is to just change one of the item names and be done with it, but I want to know if what I'm trying to do is possible. So what are your ideas?
Advertisement
It used to work in VS2005, but yeah VS2008 can't handle that. It should work if you change the other function.cpp to compile to function2.obj. You can verify from build directory that the two obj files exists.

Linker doesn't care about filenames, just that all the stuff exists in all the obj files.
Ah nice.. So I had to change the names of both OBJ files. Thank you :P
Changing the obj names isn't a great idea. The compiler is forced to wind down and back up again for each set of files that uses a non-default obj name, which can hurt compilation times dramatically.
Mike Popoloski | Journal | SlimDX
Quote:Original post by Mike.Popoloski
Changing the obj names isn't a great idea. The compiler is forced to wind down and back up again for each set of files that uses a non-default obj name, which can hurt compilation times dramatically.

Oh really. Damn. So does it compile slower or link slower? If it's just compilation (of few files VC does at once) it's acceptable. I have projects with namespaces nested three or four, and if you want to keep class names simple, you'll end up with this problem. Sounds bad to create non-descriptive class names just becouse of a defect in a VC IDE.

Maybe I will benchmark the compile times.
The hit to compile times is pretty bad...I think we cut the SlimDX full rebuild time from six minutes to two or three by eliminating duplicates.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
It's extremely irritating.

Our source folders are used to hold seperate functional areas, and each functional area has its own (nested) namespace. We workaround the bug by prefixing the file names with the "<functional area name>-", e.g. 'foo-bar.cpp'. It isn't pretty, but it does work.

I think you can also dots to mimic multiple file extensions e.g. 'bar.foo.cpp'

This topic is closed to new replies.

Advertisement