Redeveloping MFC application - c++

I've got a program written in c++ and have to make some modifications to it. Howerver, I haven't got any solution file or a like, just a bunch of .h, .cpp, .obj, .dpb, .dll, .mdi, .dfm, .res, .tds, .bpl files and an .exe file.
So I can start an application, see what it's doing and what the controls are, but when it comes to adding changes trying do to map behaviour of UI to source code files seems just to tedious.
Is it possible to recreate some kind of solution file or just to simply the process? (I am using VS 2012 and an app was written in 2002).

These file extensions indicate the source is from a Borland IDE. That .mdi file I think signifies Borland's multiple-document-interface... I'll venture to guess this project would be quite difficult to "recompile" using Visual Studio. I don't even see a .rc (resource file) in your list. Rewriting may be the easiest path, depending on the complexity of the application...

Related

what is a project in eclipse?

I've just started working with Eclipse for C++ and I just want to clarify something that I haven't been able to figure out by searching so far. Is a project folder in eclipse only intended to have one program in it? i.e., a what is meant by project is basically a C++ program? And so you're not supposed to store many different programs in one project directory? Am I understanding this correctly?
That is correct, though they are trying to change that:
http://www.eclipse.org/eclipse/development/towards-more-flexible-projects.html
Eclipse requires that the contents of each project be stored in a
single directory on disk. Every file and folder in that directory tree
on disk must belong to the project in the workspace
Project is a project. You could divine you aplication to .dll, .exe, or other stuffs. When you are developing something that could go apart in another solution the you can put apart that piece (.dll for example). When you are developing in Visual Studio you can see that projects are in final a single file that has some own functionality, and the whole program is called solution. Didn't fired up Eclipse for a while, but it goes in the same direction. I can remember that projects in Eclipse were very poor, and meaning of the project was considered with actual language that you use (Java, C/C++, PHP, PYTHON, etc.).
Good definition is that project hold some part of application (if not all of it).

Qt Creator Code File Refactoring

I was wondering if anyone know of a quick and easy way to refactor the code files in my QT Project using QTCreator? Specifically I am trying to organize my source files and Its a bit of a pain to have to go back into the project file and change the filepath for each file. Not to mention moving a dialog class is even worse (there are .ui files not included in the project but you have to change those too.
The only file renaming/moving support that is "integrated" (i.e. it updates your project file automatically) is using the active project pane with your file list, rightclick and select "rename", using "../../some/new/dir/name.cpp" to move your files. It will of course not update any #include statements, but will save you the trouble of modifying your .pro file manually. It also respects "git rename" etc...
I don't think thats possible, moving files without ide support is a pain in the... :/

My Visual C++ compiler compiles out of date source

I'm a beginner starting to use Microsoft Visual C++ Express 2010 for Windows Programming. I've created a new C++ application using native code, not managed or MFC. I had Visual Studio create for me the basic windows code to create one window with simple menus (chat.cpp). I modified this file and I was able to compile correctly and see my changes take effect.
Now I've added one more source file to the solution (intro.cpp) which I include in my header and call from within chat.cpp. This seems to work just fine, but with one problem. The compiler doesn't seem to be applying my code changes occasionally: I make various edits, recompile, and the "old" code seems to be running. Then, after a while, after I make only a tiny modification, the compiler seems to "catch up" and it runs the new code including all the previous changes I had made.
Is there some kind of cache? Do I need to tell the compiler which files to compile and which ones to just link from object files? Did I make a mistake when I added the file to the solution?
Does intro.cpp have a header file? is that in your solution too?
It's hard for me to imagine that this area of such a mature IDE has a bug here, so I would examine your file list first. Make sure that the Solution Explorer shows all the files you have added and are editing. This is the list that VS uses to determine rebuild is needed.
EDIT: I admit it's not clear to me from your description why it would fail right now. However, typically header files do not include code, it works the other way around (except for class template header files, such as the STL headers). There is some discussion about pros and cons here. The most compelling argument to me in favour of code including headers rather than vice versa is that the header file contains the interface, while the code file contains the implementation.
I would try restructuring your code to a more traditional structure where intro.cpp includes intro.h and any others it needs, and the same with chat.cpp. Then your compilation units are intro.cpp and chat.cpp, and they depend on the associated header files, so provided they are properly listed in the SOlution Explorer, all should work. You can clean up the build dependencies to avoid dups and reduce build time once you have it working as you wish.

C++ shift from Unix to Visual Studio in Windows

I am a professional working for a software firm.In my past company basically i was working on C & C++ on unix.Now i suddenly shifted to C++ on Windows and i feel like i am in a completely different world.Basically i am working on a very big application which was totally written in C++.To keep it simple ,i dont have the source code .I have the exe of the application and several other dependent files.it is a GUI application(several windows,reports,graphs and huge mathematical calculations are done by this application).Now i finally have the source code of the application which includes some headers,some vcproj files,some dsw files and several other which i dont even understand why the hell are they present.
Now as i C++ programmer my responsibility is to make all the BUGS that the clients identify replicate and fix them.
If its a bug on unix i can simply use the binary and source code and run gdb/dbx and find out the issue in some or other way like adding adding some printf statements.
But given the files i mentioned above.how could istart debugging an application in VC++ in VISUAL STUDIO.
Is it very difficult for a C++ programmer to shift from Unix to Windows.
Is ther any good resource which i could refer for this kind of change where i could grasp things quickly?
given the exe and the source code of the application how can i start debugging a program by running the application in VS C++-(BTW i am using VS 2005)
The main difference is that on Unix, you'll have Makefiles, which you won't find on Windows. Visual Studio organizes your code in projects and solutions, and those project files contain all the information VS needs to compile&link your projects.
If you have a *.sln file, just double click it to open it in VS. Then build the source (usually by pressing F6) and run in debug mode (usually F5).
More details:
A project is a collection of source files that result in 'something', usually a LIB, a DLL or an EXE.
A solution is a collection of projects. Useful when e.g. one project creates a LIB that is used by another project. When you set dependencies between projects, VS will build the projects in the right order.
Extensions used:
*.vcproj : Project file for C/C++ sources
*.vcproj..user : contains which windows are open in the GUI.
Can safely be deleted.
*.sln : Solution file
*.ncb : Intellisense database for a solution. Can safely be deleted.
*.suo : contains which windows are open in the GUI. Can safely be deleted.
*.dsw : Visual Studio 6.0 related file - not used in VS2005. (Replaced by *.sln IIRC)
./Debug/* : folder with all
intermediate files for a Debug build
(can be changed)
./Release/* : folder with all
intermediate files for a Release
build (can be changed)
That's all I can think of at the moment.
If you only have a .DSW file and not a .SLN file, then it means that the project was probably last worked on with VC6 and not one of the later Visual Studio versions.
That's a shame, because there have been lots of changes to the C++ compiler since VC6, and you're probably going to find the project doesn't compile with VS2005 without needing some minor changes to source code.
Do you have a .SLN file - if so, what's the version number at the top of the file (it's a text file)? If you don't have a .SLN file, can you get hold of VC6?
I would always try to get stuff going on an unfamiliar platform with the best matching tools, before I tried to bring it forward to later versions.
I understand your pain; I took the same path a few months ago.
You probably figured it out, but Visual Studio is not the exact alternative of gcc/g++. It embeds a text editor, a debugger, and so on.
Usually, you have two compilation "modes", debug and release. (you can add your own)
When in debug mode, all optimization are disabled and you can execute your program in the debugger, use step by step, add breakpoints, ...
Just start it using the F5 key.
More notes on the additional files:
In the Visual Studio world, .vcproj files represents "projects": a bunch of file that belongs to the same project (source files, headers, resources, ...).
A .dsw (old name for current .sln files I believe) is a "solution" file: a group of one or several projects which can have internal dependencies. Example: you can have in the same solution, a library and a software that depends on it. So that when you compile the whole solution, things are built in the correct order.
First thing you should try is to attach to the process while it's running (Ctr-Alt-P and select the process) if you have the .pdb (debug information) files you should be able to debug the process without re-building it.
If that fails try to un-check the "Require source files to exactly match the original version" option in Tools -> Options -> Debugging.
If that too fails you'll have to build the application again (by opening the .sln file and performing a build) so that the binary matches your source files.
Good luck.
Compile the code with debug info and press f5 (Start Debugging). I don't see where is the problem. On linux is sort of the same.
VS2005 can convert the dsw file for you to a sln file, but you need all of the original VC6 files in order for the conversion to be successful. For debugging please check out following msdn link, I hope this will help you.
http://msdn.microsoft.com/en-us/library/sc65sadd.aspx
Please select hyperlink "Debugging Native Code" for C++ specific.

Using Tortoise SVN with C++ in Visual Studio 2008

I have an online repository with some .h and .cpp files that make up part of a project. I'm trying to check these out and use them in a new project, but am getting errors (C4627 and C1010). All the files have been added to the project (with Add>Existing Item...), and the subdirectories that contain these files have been added to the "Additional include directories" of the project.
Would I be better off having the entire project tree in the repository? My reason for not doing so is that my colleague and I are working on different parts of the code and so want to use different main methods to test things as we go, and I didn't see any need to be passing around any compiled code etc. since I assumed that given the .h and .cpp files (with the correct settings), visual studio would be able to compile the project.
What's the best way to make Visual Studio 2008 and TortoiseSVN work well together (without spending any money)?
Would I be better off having the entire project tree in the repository?
Most certainly yes. You should be able to check out and build without much effort. Creating a new project every time you want to build the source and having to configure it is way too much work.
My reason for not doing so is that my colleague and I are working on different parts of the code and so want to use different main methods to test things as we go, and I didn't see any need to be passing around any compiled code etc.
Ok, just put more than one project in the solution. There's no reason you can't have separate executable projects for separate tests.
I assumed that given the .h and .cpp files (with the correct settings), visual studio would be able to compile the project.
If all of the settings are the same, then, yes, it should compile fine, but why bother with the hassle when you don't have to?
Also AnkhSVN which isn't too bad and it's free. Also, lots of the windows it displays look like TFS (if you're familiar with it)
What's the best way to make Visual Studio 2008 and TortoiseSVN work well together (without spending any money)?
There are a bunch of programs that integrate SVN into Visual Studio. VisualSVN is one of them.
Apologies for the VisualSVN recommendation. We used to use it in an old project and I'm positive it was free then. Maybe they changed their license?