Archived

This topic is now archived and is closed to further replies.

GekkoCube

Very strange VC++ problem.

Recommended Posts

I never had this happen to me before - ever! Today I took the DirectX 8.1 ''CreateDevice'' tutorial/sample code and used it to start my own project (brand new). After implementing the basics with my own files I compiled, built it, and ran it. everything was fine and dandy. Then, suddenly, as I was trying to save my work in a particular file called "defines.h" (tried to save using the single-disk save button menu bar), I got a message saying, "Cannot save file...this file may be in use by another application." This naturally lead me to believe that i wasnt closing my exe properly, but im doing what the tutorial did, plus i never created anything other than the d3d8 device. even stranger, and the thing that bothers me the most, is that the file (defines.h) will be deleted somehow! At one time I lost my defines.h file AND my main.cpp file!! What on earth is going on? I hope its not a virus!

Share this post


Link to post
Share on other sites
I also had this problem once. Norton Anti-virus somehow locked my source files. Try to fiddle with the settings in any anti-virus stuff you have running and see if it helps.


"Oh no, not again" - Agrajag

Share this post


Link to post
Share on other sites
One more thing, this problem of the disability to save the file and automatically being deleted, it seems to be provoked by the save-file button.

However, if i click the save-all button, there is no problem.

Share this post


Link to post
Share on other sites
locking of source files?
you mean Norton Antivirus (which i have) will lock c++ source files???
but this has never happened to me before - however, i believe this is the first time i created a new win32 application project with this new computer.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
When you are getting this message - press CTRL+ALT+DELETE in Win2K / XP or right-click on the task bar in 9x and, in both cases, choose "Task Manager". Under the Processes tab, look for your programs exe file to see if it is still running (do this, of course, after having run and then closed your program). It should not be there if your program is closing properly.

If it is then you can "end task" it and try your save again. i would try this immediately if, for example, my program would not recompile after runnning. If this doesn''t work you could try "end tasking" other .exes to see if you close the one that has control of your file (e.g. norton anti virus exes).

Share this post


Link to post
Share on other sites
When you are getting this message - press CTRL+ALT+DELETE in Win2K / XP or right-click on the task bar in 9x and, in both cases, choose "Task Manager". Under the Processes tab, look for your programs exe file to see if it is still running (do this, of course, after having run and then closed your program). It should not be there if your program is closing properly.

If it is then you can "end task" it and try your save again. i would try this immediately if, for example, my program would not recompile after runnning. If this doesn''t work you could try "end tasking" other .exes to see if you close the one that has control of your file (e.g. norton anti virus exes).

Share this post


Link to post
Share on other sites
I did a lot of Usenet searching, and it seems to be a common problem. Most people suggested turning off Nortons Auto-Protect function. "Solved" the problem for me. It''s worth a try, no? Or get some other virus protection.

Share this post


Link to post
Share on other sites
I did what you suggested, i disabled auto-protect for my Norton Antivirus software. i also tried closing Norton altogether.
But this does not help.

Things to note:
Other projects do not have this problem.
And using the save button brings this problem, using save all or using ctrl-s does not affect it at all.

When you had this "problem" did your file(s) delete automatically from the directory??? This is the thing that bothers me the MOST!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Then make a copy of your files in a different directory. This is called a "backup". Also, try reinstalling Visual Studio. You have probably corrupted it with your faffing about.

Share this post


Link to post
Share on other sites
quote:
Original post by GekkoCube
When you had this "problem" did your file(s) delete automatically from the directory???

Yes. But when I tried saving a few seconds later, they mysteriously reappeared.

Share this post


Link to post
Share on other sites
Had the same problem for a long time now... every other time I press the save button, I get the same message, but if I press save again a second later, everything is saved and works just fine, but it is really annoying. I''ll try disabling auto-protect...


// Website // Google // GameDev // NeHe // MSDN //

Share this post


Link to post
Share on other sites
OK, i''ll do what everybody suggests.
I already made that backup directory with all my files, just in case i lose files again.
It just freaked me out the first time i lost my main.cpp.
I just don''t want that happening when my source code is huge...plus, I DO NOT want to make a backup copy everytime!
I will definitely reinstall visual studio and see if that helps too.

Share this post


Link to post
Share on other sites
quote:
Original post by neoztar
Had the same problem for a long time now... every other time I press the save button, I get the same message, but if I press save again a second later, everything is saved and works just fine, but it is really annoying. I''ll try disabling auto-protect...

Me too


pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code

Share this post


Link to post
Share on other sites
Just write a batch file to copy your main C++ files from one folder to another. That is, start a text file and put in lines similar to:

copy [SOURCE FILE PATH] [DESTINATION FOLDER PATH]

Where your pathfor the file will be something like:

C:\Projects\GameEngine\main.cpp

And for the folder will be like:

C:\Backup


Note: If your folders have spaces in the name then you need to encapsulate the path in quote "" marks. Put in a line for each of the main files (or ... in fact just copy folder to folder). Save the text file with the extension .bat

That way to do a complete backup you only need to double-click on the batch file.

Share this post


Link to post
Share on other sites
ERROR MESSAGE: "Cannot Save File" in Visual C++ IDE

From my personal experience, guess you all are using XP (2000 do happen too, but not as frequent as in XP). In Win98SE and WinNT4), the save button works flawlessly (err... I mean no such encounter thus far ). This happen on MSVC6. I'm not sure about MSVC5.

Just click the save button few times until you really save it.



[edited by - DerekSaw on January 29, 2003 8:38:10 PM]

[edited by - DerekSaw on January 29, 2003 8:40:56 PM]

Share this post


Link to post
Share on other sites
Thanks for all the help.
If I click the save button every other time, it works fine.
Previous times i stopped after encountering the first error message - at which point i noticed the file to be missing.
But apparantly saving again will reveal the file to be there...weird.
But I will backup all files, just in case.

Weird how my previous projects that i had created under my old computer under win98se had no problems like this ever.
but my first project created under XP and....you know what!

Anyways, thanks again.
I no longer have to freak out when that happens.

Share this post


Link to post
Share on other sites