View Full Version : Converting from C to C++
besjr
11-27-2005, 10:48 AM
ALL,
I have a very complex gauge that I've developed in C using MSDEV Studio 97. I want to add TCAS to my ND, but the new headers are written in C++. I figure in order to do this I would have to write the whole gauge into C++ format, but when I included the new gauge.h file, I get a ton of errors. I know that C++ is reverse compatible with C. Does anyone know how to properly setup the IDE for C++? I think I can muddle through the rest if I knew that.
n4gix
11-27-2005, 11:32 AM
Have you tried simply renaming your .c files to .cpp? Rename the files, then begin a new Project using them.
In very general terms, conversion of a C only gauge to one which will use C++ involves two steps:
1 Rename Or Copy Code
Rename or copy the c source files from *.c to whichever extension is used by your C++ compiler (usually *.cpp).
2 Modify Code Comments
Comments in the source code can be left in the /* style, but for those who work in both C and C++, having native C++ comments in // style makes it easier to switch between languages.
matsis
11-27-2005, 03:25 PM
In working with MS Visual C++ 6.0 it's all *.c and *.h files, no *.cpp necessary.
About how to set up an IDE in VC6.0 there was a step by step tutorial that taught me how. I now do it manually by copy/paste and modifying by hand. I can dig it up for you if you are using this Version. Bill has posted the setting up in the newer Net Version in one of the stickies at the top of this forum.
n4gix
11-28-2005, 10:05 AM
While the use of the .cpp extension is indeed 'optional,' the extension itself is a 'flag' that informs the compiler you wish to compile using the C++ libraries...
The tutorial referred to is "idehowto.zip":
http://www.flightsim.com/cgi/kdl/main/17/idehowto.zip?5vTxE02t
matsis
11-30-2005, 04:52 PM
Thanks Bill for clarification and supplementing my memory as to "idehowto.zip" :)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.