Sign in to follow this  
Wavarian

VS2008 - Project items with same name

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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'

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this