Hi

i want to convert my C project to C++. so does anyone knows any tool that converts a C program to C++

Recommended Answers

All 3 Replies

The Brain - the one and only

Hello,

You shouldn't need it, unless you have a bunch of libraries, or are using depreciated methods to implement your thingy. C++ is an extension (add-in) to C, and you can get printf and a bunch of other functions to work just fine within it.

Now, if you are looking for unified code, then I think it is going to be a manual process indeed. IN that case, you could convert your libraries one at a time, as they should still link fine. I am not aware of any big hiccups here.

Christian

Compilers are usually set up to compile files with ".c" extensions as C and ".cpp" as C++; so if you are going to add C++ only stuff, the first thing to do is rename your .c files as .cpp. (and update the project file accordingly)

Once you do that, you should be able to build and run, and then you can incrementally add/change things to use C++ syntax extensions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.