How to swim when jumping in the C++ deep end

Hey All!
I have been tasked to take over a project. There is no one to help.
I haven't looked at the code yet, but was told it is C++. Will someone PLEASE give me some hints, tips, guide, links, ANYTHING on how to move forward. I've coded in ASP.NET, and VB.Net, but not c++

When they hand me the "CD with the code", what are my first steps?
How do I know what version it is?
How do I know if it is one of these below?
C++/MFC
C++/ATL
C++/BCL
C++/.NET

Keeping my head above water,
AJ

1
2
3
  var = i;
  i= 'help';
  print i+" plz";
Last edited on
0) take a look. .cpp, .h maybe .hpp are the extensions of c++ source code. .c is C code. Old unix code can use C instead of cpp living off the case sensitive file name to denote c vs C for C vs C++.

1) IF it is actually c++, you should run through learncpp.com as quickly as your head can absorb it.
1.b) -- c++ is said to take years to master. It will take a while to learn if those are your languages... do you know any red-headed-step-children of C or c++? Those are java, c#, even pascal or javascript ... ? Javascript is surprisingly like c++ at the basic core level.
1.c) do not be afraid to refuse this or push back. this may be too much to take on if the project is very large and complex. To put that in perspective, I am pretty good, not the best, but pretty good at c++ and am closing in on a year at a new job and still don't have a great handle on our main program's source code. It would be unpossible for a non c++ speaker to handle a large project and get anywhere with it unless given a very, very generous time frame. They need to hire a c++ speaker, if this is important and has a deadline etc. At the very least, you need to take a look at it, get its scope and complexity in hand, and present a "I can or can't do this in a reasonable timeframe" to your manager so they know what to expect.

2) you should take the cd with the code and copy it to a hard drive, then try to build the program in an appropriate environment. Is it windows? Unix? many OS? Something else?? In the process, you want to read any and all documentation you have available on it. Also ask whoever you got it from.. if they are still alive and accessible. SOMEONE should have some info. Is this out in the wild? Where is the latest build, and does that match what you get when you compile off the code you got? If you seem to have a different version, you may not have the latest code, etc.

3) what version is tricky. some options:
- if there is a project file, you may be able to deduce from it, eg visual studio has a language setting like c++17, as does g++. If you lack that, you can tell by the code as an expert, but its hard... I can't recall what is 11 vs 17 at times... or older... This really matters less than you think. Ignoring a microscopic handful of items, by and large the latest language setting will work on older code. If it won't compile with the latest, drop a level until it does. There are only like 5 options... 20, 17, 11, 98, ancient. Generally speaking, it will work on either the latest visual studio, version 6.0, or g++. One of those 3 should get you something. If none do, list the files that are not .cpp nor .h nor .lib/dll/exe/obj/o/so/pch/pdb/ilk/ianything extensions. look for make, mak, proj, vc, type files at the highest level. If it is so old it needs 6.0 or something awful like that, you may not be able to salvage it.

4)MFC etc.. here again the project will clue you in based off what libraries it uses and how it is configured. Documentation, handoff .. ask this of the people giving it to you. Deducing it from the code is possible but you need a bit of background. If it has an excessive amount of gcnew statements and ^ symbols, its .net managed. If it has a bunch of 'handles', CStrings, and screwy macros, its MFC. The others, I am not sure what to look for.

Last edited on
Thank you! Great information.
You’ve been handed code that you have never maintained before, in a language everyone knows you are unfamiliar with...

You have time to take a week or two just to learn the language, let alone familiarize yourself with the codebase.

I recommend you head on over to https://www.learncpp.com and start working your way through the tutorials.

Also, take the time to glance through the codebase and see what kinds of stuff you find. You don’t need to do anything more than just glance it through so you have a rough idea of what is where and what the docs and comments say.

Do those two things and you will be ready to begin proper maintenance. Should you need to learn something like MFC you will find that as you do the two things I recommended.

Remember, Google is your friend here. Should you find anything particularly weird you can always ask generalized questions about it here. Having worked with VB.Net will help you a lot — many OOP ideas will translate to the same kind of thing, only the syntax will be different, and you will pick that up easily.

Good luck!
Last edited on
What are you supposed to do with the project - fixing bugs, adding new functionality, change existing functionality...?
Do you have a certain time-frame ?
Once you have the CD, one of the first things you will need to do is to scope the project. How many c/cpp/hpp/h files are there? Approx what are the size of the largest files? What are you being asked to do? What time-scales have you been given? Doing a minor change to a c++ program which is say a couple of hundred lines is one thing, doing it to a project with say 100 program files each of thousands of lines is another ball game entirely.

If you post say the first 20 lines of a few of the longer c/cpp/hpp files then we should be able to let you know whether it's straight c/c++ or mfc or c++/cli or...

Is this project gui based or console based? If gui and standard c++ then it will use a 3rd party gui library. This could be MFC, win32 (both Microsoft if for Windows) or another such as qt etc. In this case as well as getting to grips with C++, you'll also have to get to grips with any 3rd party gui library.

If this project has been previously compiled with Microsoft VS, are there any .sln/.vcxprog files? If yes and you are using MS VS you may be able to open the project within VS by just opening the .sln file.

Also note that if you use VS, you need to manually set the install options to install c++. By default with VS install it doesn't automatically install C++ be default.
Be careful about asking people to post code from their job online. That can get them in serious trouble...
@Duthomhas - Great information, thank you.
@thmm - Fix bugs & add new functionality. 3 month timeframe to be able to work in the environment.
@seeplus - Great information, thank you.

I'm very surprised to see such great feedback on this community and appreciate it. Some forums just attack newbies.
Topic archived. No new replies allowed.