Link to home
Start Free TrialLog in
Avatar of RJV
RJV

asked on

Changing the name of a Visual C++ project or workspace

How does one change the name of a Visual C++ project such that it creates an EXE with a different name, shows a different name in its resouces, etc?

RJV
ASKER CERTIFIED SOLUTION
Avatar of trestan
trestan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another way is to make changes in .dsp file, but I do not think it will be an easier work than the previous methods. You have to make the changes to filenames in either way.
Nice day.
Avatar of RJV
RJV

ASKER

Trestan,

What do you mean by include other files? Namely, what happens to the CLW file, for example? How is the main file located when it is linked, not to mention it's header file when included in other cpp files?

RJV

I mean there are more than one files in your project. You can either change their names in .dsp file to their new names or by compiling the principle file (at this time, one this file is existed in the project, so you need to add others manuelly.) I do not think you need to change CLW file.
Since you mainly want to change the .exe name, so just change the "main" filename is enough. The less change you made, the less trouble in compiling. Otherwise you have to modify the CLW manually. However, I suggest you make as much less as possible.
Avatar of RJV

ASKER

Trestan,

Your explanation is very unclear. I have a working project, with several files and classes. Simply renaming the main CPP file means that the classes continue with the same name, for example. That is, unless I rename those, which will impact the rest of the project. This not to mention the header file's name and references to it. What I want to do is to use most of that project in another, including the resources, eliminating about 30% of the original.

I'd appreciate your giving clearer explanations, particularly as the change should affect more than you are indicating.

RJV

Since in your original question you want to change the .exe file name, so I do not think you need to change the class name. For example, if you create a project named MyProj, then there will be a file named MyProj.cpp. The executable will be MyProj.exe. If you want another exe name, just change MyProj.cpp to MyNewProj.cpp, do as I said, then you will have MyNewProj.exe. But I guess you want make more changes to your project. So I think you must make clear what your goat is. I guess you want to make some changes to the class name, right? If so, you have to make all changes related with this class name and the file containing this class. However, I really think I have made clear illustration but maybe your question related to wider range than I supposed to be. Pls give me more clues about what you want. thx
Avatar of RJV

ASKER

Trestan,

Your explanation is very unclear. I have a working project, with several files and classes. Simply renaming the main CPP file means that the classes continue with the same name, for example. That is, unless I rename those, which will impact the rest of the project. This not to mention the header file's name and references to it. What I want to do is to use most of that project in another, including the resources, eliminating about 30% of the original.

I'd appreciate your giving clearer explanations, particularly as the change should affect more than you are indicating.

RJV

Avatar of RJV

ASKER

So far, not so simple. I copied the whole project to another subdirectory (as the original will still exist) and renamed MyProj.cpp to MyNewProj.cpp. The result is that I get a link error as the compiler/linker tries to get variables that are in the original directory/folder/subdirectory.

I'd like to get this to work first and foremost. However, I would like to have CMyProjectDoc and CMyProjectView named as CMyNewProjectDoc and CMyProjectNew, repectively. This not to mention CMyProjectApp renamed to CMyNewProjectApp. This would make things a bit clearer.

Overall, so far not an easy job. As you've been down this rode before, let me know where the holes are and how to avoid them.

RJV

At first, change the .exe name. The simplest way: modify the output file name in the Link tab of the project setting, recompile the project. Then you get the new exe file. The second: Export a mak file under the Project menu commend. Make changes in this file and open this file instead of .dsw .
There will be a lot of trouble if you want to change the names of the classes. One seemed to be stupid but works way is to recreate a App under new name, the wizard will create all the corresponding class for you, then you copy your codes from the old one. The second way is to change the class name manually. I suggest you make change to one class each time and make sure make changes everywhere. (Use find in Files to find all the old name). The CLW will ask you to modify the class name. Or you delete the CLW file, after you make all the changes you want, recreate by compiling the project. Ok, tell me if you met any further trouble. Good luck.
Avatar of RJV

ASKER

I tried essentially all of the recommendations you made except for the EXE alternative. However, I had another possibility and as time is essential, I went along that route. Basically, creating the project from scratch and making changes to it to reflect the original. It is now compiled, done, working and ready for the changes to make it fully operational.

Thanks for the input in the meantime.

RJV