source file: 'Source.cpp' - What did I screw up to make this even exist?

May 11, 2018 at 10:15pm
How do I even find a reference to a source file named Source.cpp in Visual Studio 2017?

None of the search utilities I am used to using will work because the entire project is stored in Microsoft's 16 bit character format instead of regular ASCII, so all of the text has nulls every other character. So, using grep or find is out.

The built in find in files function reports 0 files contain the phrase Source.cpp also.


unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?


Nope, I screwed something up somewhere in the resource editor and I don't know what it was or how to find out. The file Source.cpp is completely empty. I don't know why it was created. Even more bizarre, it's backdated to April 22nd, around when I started playing with this, but this error just started showing up today.

How do I tell Visual Studio 2017 that "Source.cpp" is NOT any part of WindowsProject2? I can't find that anywhere and have spent an hour looking for help to what probably is a stupid question.

The program, while it didn't do much, was working yesterday. Now because I triggered something in the dialog box or menu editor or something, it won't even compile.

(Adding headers into an empty file to produce an inert turd might fix the problem but I'm pretty sure that's not what I want to learn. Please help me fix this correctly?)
May 12, 2018 at 3:15am
16-bit encoding is not the default, you must've messed with the settings somehow... shouldn't be too hard to get it back to UTF-8.

As to your actual problem, try turning off precompiled headers.

Project Properties -> C++ -> Precompiled Headers

set Precompiled Header to "Not Using Precompiled Header".
May 12, 2018 at 5:40am
Its Visual Studio 2017, the community edition, installed in the last month or so. I definitely didn't choose to have my .cpp encoded that way but its entirely possible that was set somewhere in this laptop in Windows as a system wide thing, this was a display model prior to being mine, and it wasn't fully scrubbed before I started using it (oops). It didnt have VS on it when I got it though, but that doesnt mean VS didnt inherit a setting or something. Gotta check that out. Thanks.

I do remember seeing something about adding "Source1.cpp" to the project though. I just don't remember where or know how to find it. The file is empty because I just closed it at the time and didn't think I saved it - apparently clicking the upper right hand corner X on a file without ever pressing ctrl-s somehow still saves files in VS (figures, the only time I wish I hadn't saved, Microsoft does it for me. Gee, thanks..). It didn't cause any problems until this morning, when suddenly the compiler decided the file and its contents mattered.

Removing the file results in a file not found error.

Is there any way to tell what button or menu item I bound that file too, and how can I remove an source file properly? Just deleting it doesn't work.

Its source.cpp that gives the unexpected EOF. Naturally - its totally blank. That's not where the source code is. Never was.

I need to eliminate the reference to source.cpp entirely. then I can just delete the file and the error wont happen any more. but I don't know whats referencing it or why.
May 12, 2018 at 8:46pm
I realized I could just ignore every other character and grep anyways:
/cygdrive/c/Users/Jason/source/repos/WindowsProject2$ grep -aRic S.o.u.r.c.e...c.p.p . | grep -v ":0"
./.vs/WindowsProject2/v15/.suo:3
./WindowsProject2/x64/Debug/WindowsProject2.tlog/CL.write.1.tlog:1

So there's a .v15 directory and a file in there called .suo that contains the reference to Source.cpp. That file contains a whole mess of stuff in an unknown format. It must tell VS something about what to do but its nothing I'm going to be able to edit like a Makefile, that's for sure - it's text and binary data.

So I have to fix this in the GUI. Somehow. Ugh.
May 12, 2018 at 8:54pm
...so I closed Visual Studio and re-opened it and Source.cpp was suddenly listed under the "Source Files" tab in the Solution Explorer (it wasn't before) and so I permanently removed it and now its gone.

It works now. But I still don't know why it wasn't there before.

Oh well. Fun times.
Topic archived. No new replies allowed.