I was trying to #include
a cpp file with some functions so I can use that cpp file later with other projects. It gave me an 'already defined in .obj' error and since then that .cpp file was like binded with my project. (I understood that's not the way, the answer here helped me with the already defined)
If I exclude the .cpp file from the project, remove it from the directory and remove the #include
line it still looks for it:
c1xx : fatal error C1083: Cannot open source file: 'std.cpp': No such file or directory
Diagnostic:
Outputs for D:\MY DOCUMENTS\C#\PROJECT\D3DTESTC++\COWS AND BULLS\CBMAIN.CPP|D:\MY DOCUMENTS\C#\PROJECT\D3DTESTC++\COWS AND BULLS\STD.CPP: (TaskId:15)
It shouldn't be looking for the std.cpp at all, I removed it! So is there a way I can reset the project and recompile so that the program doesn't look for it? I already tried Rebuild and Clear -> Build Project
Try to verbose builder output to see exact steps of what's going on. I suppose, you use Visual Studio, right?
Builder dump should shed more light on your current settings (I suspect you have more references to that file than you expect)
OK, I have no idea how I did it but I'm still going to try to write what I did.
That's exactly what I did and worked for me. I think the main thing to do is clean, save, close, open, build, but I'm not sure.
This happened to me because I renamed folder from inside the IDE. None of the above solutions worked. The only way to fix this is by opening vcproj in notepad and you should see the offending files in the
<ItemGroup>
. Just delete those lines.Many of the solutions here will not work
Fullproof method:
I removed those sources from Project and re-added them. Somehow, references were messed up after a hurry project refactoring.
This helped in my case. To sum it up, my path to the project was too long, so I moved my project to something shorter i.e.
D:\my_project
and everything worked in a blink of an eye.