Bonnev Bonnev - 3 years ago 68
C++ Question

"Error C1083: Cannot open source file" Shouldn't Be Looking For The File At All

I was trying to

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
line it still looks for it:

c1xx : fatal error C1083: Cannot open source file: 'std.cpp': No such file or directory



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

Answer Source

OK, I have no idea how I did it but I'm still going to try to write what I did.

  1. Save all and Close solution
  2. Open the .vcxproj file (not .sln)
  3. Build -> Clean [Project Name]
  4. Save all and Close
  5. Open the .sln file again.
  6. Build -> Project Only -> Clean Only [Project Name]
  7. Build -> Project Only -> Build Only [Project Name]

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download