I'm using Visual Studio 2010 to compile my C++ project, and the linker is barfing on two of my files which have the same name- but they're in completely different directories. How can I make the linker recognize that they are different files?
In Visual Studio, make sure the source file that defines the symbol gets compiled as part of your project. Check the intermediate build output directory for a matching . obj file. If the source file isn't compiled, right-click on the file in Solution Explorer and choose Properties to check the properties of the file.
You can try linking the object file to your application by: Go to project properties then from "Property Page" select the node "C/C++" their you will get "Additional Include Directories" add the name of your object file.
I believe the problem comes from the fact that all your .obj files are written to the same folder, and so the outputs from compiling those two source files are colliding. I think there are at least two possible solutions:
I'm not certain about the first option, but for the second, you should be able to right-click the source file in the solution explorer, select "Properties", and find some configuration setting to over-ride the output (.obj) file created for that source file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With