Added a new file to a Project. (Program won't compile afterwards.)
-
The file I added, was actually present in the project workspace before, under a different name. Following some changes I made to the file, I gave it a new name, and then deleted the old version from the workspace, followed by adding the newly named one to the same workspace (using Project->Add To Project->Files). Other changes made, were to the "#include" statement in the program, and the directory where the program and its files are located. Did a "Rebuild All" and the compiler came back saying it couldn't open the newly named file. Any idea why the compiler is not seeing the newly added file in "Dev Studio"?? Thanks! :confused: William Fortes in fide et opere!
Switch to the file list and right click on the file to get its properties. Is the file really where VC thinks it is? Also, changing files can quite often confuse the poor IDE, so close VC, and delete the projects NCB file. Run VC again, and do a "Rebuild All". It should be okay now. Iain.
-
Switch to the file list and right click on the file to get its properties. Is the file really where VC thinks it is? Also, changing files can quite often confuse the poor IDE, so close VC, and delete the projects NCB file. Run VC again, and do a "Rebuild All". It should be okay now. Iain.
Thanks for replying. Tried your suggestion. It didn't help. The same error keeps getting cited. Also ran a little experiment. I removed ALL the C++ files the project uses (everyone of them), then did a "Rebuild all" and the same single error returned about not being able to open that newly named file I've been talking about (even though the physical file is no longer in the directory with the ".exe" file. Interestingly, the compiler made no mention about the other files that were removed also. It just said it couldn't find that one file. (Yes, I did delete the ".ncb" file followed by a "Rebuild all". Dev Studio is a strange creature after all, and it stands to fact I've much to learn about its idiosyncrasies. :sigh: William Fortes in fide et opere!
-
Thanks for replying. Tried your suggestion. It didn't help. The same error keeps getting cited. Also ran a little experiment. I removed ALL the C++ files the project uses (everyone of them), then did a "Rebuild all" and the same single error returned about not being able to open that newly named file I've been talking about (even though the physical file is no longer in the directory with the ".exe" file. Interestingly, the compiler made no mention about the other files that were removed also. It just said it couldn't find that one file. (Yes, I did delete the ".ncb" file followed by a "Rebuild all". Dev Studio is a strange creature after all, and it stands to fact I've much to learn about its idiosyncrasies. :sigh: William Fortes in fide et opere!
By implication, I presume the file you are talking about is not a C/CPP/H file. It is a dependency of other files in your project (e.g. resource). Do you custom-build it into an intermediate file which is included in your project? I would open the project settings and check for mention in your file in any of the command line parameter bits on the bottom right. This may give you a clue. Iain.
-
By implication, I presume the file you are talking about is not a C/CPP/H file. It is a dependency of other files in your project (e.g. resource). Do you custom-build it into an intermediate file which is included in your project? I would open the project settings and check for mention in your file in any of the command line parameter bits on the bottom right. This may give you a clue. Iain.
The file in question is a C++ file, in that it has ".h" as it's extension. In reality, it is a MACRO file that I have all sorts of macros in, which as a matter of routine I '#include' it in nearly all my programs. Recently however, I began doing some house cleaning on it, hence the reason for renaming it, and it's that new name that the program is saying it cannot find to open the file (even though the file is physically present in the same directory as the ".exe" file). The same renamed file is also present in the project workspace which when I click on it, I see all the new changes I made to it. I cannot understand why the compiler is saying it is unable to find the file. Thanks for your continued suggestions. :confused: William Fortes in fide et opere!
-
The file in question is a C++ file, in that it has ".h" as it's extension. In reality, it is a MACRO file that I have all sorts of macros in, which as a matter of routine I '#include' it in nearly all my programs. Recently however, I began doing some house cleaning on it, hence the reason for renaming it, and it's that new name that the program is saying it cannot find to open the file (even though the file is physically present in the same directory as the ".exe" file). The same renamed file is also present in the project workspace which when I click on it, I see all the new changes I made to it. I cannot understand why the compiler is saying it is unable to find the file. Thanks for your continued suggestions. :confused: William Fortes in fide et opere!
by default the file is expected to be in the same directory as the project (.dsp) file, otherwise you need to do one of the following; a) mangle the include statement in your files (e.g. #include "..\common\abc.h", or b) add the path via Project -> Settings -> C++ -> Preprocessor -> Additional Include directories. nb
-
The file in question is a C++ file, in that it has ".h" as it's extension. In reality, it is a MACRO file that I have all sorts of macros in, which as a matter of routine I '#include' it in nearly all my programs. Recently however, I began doing some house cleaning on it, hence the reason for renaming it, and it's that new name that the program is saying it cannot find to open the file (even though the file is physically present in the same directory as the ".exe" file). The same renamed file is also present in the project workspace which when I click on it, I see all the new changes I made to it. I cannot understand why the compiler is saying it is unable to find the file. Thanks for your continued suggestions. :confused: William Fortes in fide et opere!
WREY wrote: ...the program is saying it cannot find to open the file (even though the file is physically present in the same directory as the ".exe" file). Which is usually the Debug or Release folder. Try moving the file up one level to the actual project's folder.
-
by default the file is expected to be in the same directory as the project (.dsp) file, otherwise you need to do one of the following; a) mangle the include statement in your files (e.g. #include "..\common\abc.h", or b) add the path via Project -> Settings -> C++ -> Preprocessor -> Additional Include directories. nb
Thanks for replying. I think some confusion is beginning to emerge between the use of the word "folder" and "directory" (and maybe I hold some blame for that). I use the word "folder" to mean, "a place in a directory where one or more files are located." "Directory," I use, to denote a path from the drive letter where a certain "folder" is located. Some of the answers I get (well-intentioned as they are), are beginning to reflect this confusion, which if I can help clear things up, "The newly named file, resides in the same folder (in the same directory) as the ".dsp" file." Unlike C++ where the programmer can do some rather clever things and the compiler will go along with his code, "Dev Studio" is not very clever. Simply substituting a file by removing the old one from the workspace and "adding in" a new one to the same workspace, is too complicated a task for it to understand and do. What I simply did, was made some changes to a file, then renamed the file (no change of folder or directory done). Next, I went into the project workspace, deleted the old file and "added" the newly named file (which is residing in the same folder and directory as the old file) into the same workspace. Then I changed the "#include" statements in the program where references to the old file name were made, so that it would now refer to the new name, and did a "Rebuild all". That's it!!!! The rest is already known about the compiler saying it cannot open the newly named file. I've already spent too much time on this problem, and what I'll end up doing, is simply create a new project and add in ALL the files I'll need, and resolve this issue that way. Dev Studio needs some overhauling and I don't believe MS has any intention of doing that. In their view, "It's not broken enough." :( William Fortes in fide et opere!
-
WREY wrote: ...the program is saying it cannot find to open the file (even though the file is physically present in the same directory as the ".exe" file). Which is usually the Debug or Release folder. Try moving the file up one level to the actual project's folder.
Thanks for replying. No. The newly named file resides in the same folder as the ".dsp" file, which is a different folder than Debug or Release, but which ALL reside in the same directory. If I'm not mistaken, my understanding is that an ".exe" file will automatically look up one level above, in the same directory where it resides (and any number of levels below [in the same directory]), to find the files it will need to access (which is why I said, "the file is physically present in the same directory as the '.exe' file"). ;) William Fortes in fide et opere!
-
Thanks for replying. I think some confusion is beginning to emerge between the use of the word "folder" and "directory" (and maybe I hold some blame for that). I use the word "folder" to mean, "a place in a directory where one or more files are located." "Directory," I use, to denote a path from the drive letter where a certain "folder" is located. Some of the answers I get (well-intentioned as they are), are beginning to reflect this confusion, which if I can help clear things up, "The newly named file, resides in the same folder (in the same directory) as the ".dsp" file." Unlike C++ where the programmer can do some rather clever things and the compiler will go along with his code, "Dev Studio" is not very clever. Simply substituting a file by removing the old one from the workspace and "adding in" a new one to the same workspace, is too complicated a task for it to understand and do. What I simply did, was made some changes to a file, then renamed the file (no change of folder or directory done). Next, I went into the project workspace, deleted the old file and "added" the newly named file (which is residing in the same folder and directory as the old file) into the same workspace. Then I changed the "#include" statements in the program where references to the old file name were made, so that it would now refer to the new name, and did a "Rebuild all". That's it!!!! The rest is already known about the compiler saying it cannot open the newly named file. I've already spent too much time on this problem, and what I'll end up doing, is simply create a new project and add in ALL the files I'll need, and resolve this issue that way. Dev Studio needs some overhauling and I don't believe MS has any intention of doing that. In their view, "It's not broken enough." :( William Fortes in fide et opere!
Strange indeed. What happens if you reverse all of these changes such that the file has its old name and all references to the old file are put back in place? Short of that, you might not even need to add the .H file to the project. For all new classes that I (not ClassWizard) create in my project, I only add the .CPP file. A
#include
statement with the corresponding .H file is all that's necessary. -
Thanks for replying. Tried your suggestion. It didn't help. The same error keeps getting cited. Also ran a little experiment. I removed ALL the C++ files the project uses (everyone of them), then did a "Rebuild all" and the same single error returned about not being able to open that newly named file I've been talking about (even though the physical file is no longer in the directory with the ".exe" file. Interestingly, the compiler made no mention about the other files that were removed also. It just said it couldn't find that one file. (Yes, I did delete the ".ncb" file followed by a "Rebuild all". Dev Studio is a strange creature after all, and it stands to fact I've much to learn about its idiosyncrasies. :sigh: William Fortes in fide et opere!
WREY wrote: Yes, I did delete the ".ncb" file followed by a "Rebuild all". What about the .CLW, .APS, .PCH, .PDB, .ILK, .SBR, .BSC, and .OPT files. Does removing them help?
-
WREY wrote: Yes, I did delete the ".ncb" file followed by a "Rebuild all". What about the .CLW, .APS, .PCH, .PDB, .ILK, .SBR, .BSC, and .OPT files. Does removing them help?
Thanks for replying. No, I didn't go that far as to the removing of all those other files. What I've done, is simply created another project and added in those files I'll be using, then I did a "Rebuild all" and everything went well. Now I can go on with my work. It is sad that I'll never find out what would have made "Dev Studio" gotten itself out of this mess. The good news is that I won't have to waste anymore time thinking "Dev Studio" would have eventually gotten itself out of the mess. The moral of the story is, "When it comes to 'Dev Studio' AppWizard, and ClassWizard, keep things simple, otherwise you'll pay with a hefty waste of hours." Thanks for all your input, I appreciate them. :) William Fortes in fide et opere!