How do you develop an interface for an existing C++ program?

Hello Everyone,

I have a large and complex program, which to be honest I dont fully understand, that I have to develop an interface for. I understand how the program works to an extent, but the level of C++ used in the program is way beyond me. It has to do with genetic programming, programs writing programs, so I dont think that im going to be learning how to do that anytime soon. Although I am alot better with VC++ than C++ and can comfortably develop simple interfaces to perform a variety of functions.

I have been working my way slowly through sams VC++ for beginners and have learned quiet a bit, although I am still mostly a beginner. The biggest problem I have is that I do not know how to develop an interface for an existing program.

I thought that one way I could get across this would be to save the file as "***.h" and then include this at the top of my code with the command

[code]#include "***.h"[/code].

The reasoning was that it would allow me to use the variables and such in the program so that I could display them in my new VC++ program. The plan was to then use create an instance of the ant program class using the code

[code] Antsimple ant = Antsimple;[/code].

Then finally to use the desired variables using maybe the following code;

[code]MessageBox(ant.variable);[/code]

However I came across a variety of problems. Firstly I opened the orignal C++ program in the VC++ environment and it would not compile. Secondly saving the file and using the code

[code] #include "antsimple.h" [/code]

in the new VC++ program would not let the new program compile. I have absolutely no idea where to go from here. Could somebody offer some assistance

Previously I used Borland C++ 5.5 and the orignal C++ program ran fine on that compiler. To develop the interfaces I am using VC++ 6.0 and on this the original C++ program does not work.

To help clarify the error message I recieved when compiling the orignal c++ program in the vc++ enviroment is as follows;

Compiling...
antsimplea.cpp
c:\documents and settings\desktop\new folder\antsimplea.cpp(11) : fatal error C1083: Cannot open include file: 'mem.h': No such file or directory
Error executing cl.exe.

Any help would be great, even if it is a point to a tutorial. But please if you do provide links, please be sure that they are specific to my problem.

Thank You
Jaz


Answer this question

How do you develop an interface for an existing C++ program?

  • Sérgio Vasquez

    What methods are called from value.h look for these methods in http://msdn.microsoft.com and see where they are defined in the VC++ tools. Also, you might find some methods that don't have matching ones in VC++ and vice versa, you will need to look at what they are trying to do and search for similar methods (could be under different names)

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Luke..

    I wouldn't recommend mixing the VC++ tools with headers from the borland compiler. Either use the VC++ tools all the way or the Borland one. The Borland headers may not compile as expected using the VC++ compiler.

    Also, for the error you are getting try inlcluding the full path of the file or adjust the include path through the IDE or using the /I compiler option.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • RohanPynor

    Well substituting mem.h with memory.h seemed to do the trick because it seemed to be an outdated header file. What can I use instead of the value.h header

  • Kawish

    This may sound like a very stupid question and I appologise in advance if it is, but baring in mind I am a beginner, how do I find the methods that are called from value.h The program is very complex, composed of about 600 lines, im not sure where to start looking.

  • jelleyfish

    I agree with Nishant and that it is what I was trying to explain in my last post.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Scottah

    I found a description of the values.h file on a site as follows;

    `values.h'
    A collection of constants defining the numbers of bits in builtin types, minimum and maximum values, and the like.


    Does this mean anything to anyone What header file does visual c++ have that I can use to replace this

  • Vincent D. - Nolme Informatique

    I have searched through the Borland Compiler folder and have located the men.h header file. I have placed it in the same folder as the cpp file but the error still occurs.

  • Patrick Strateman

    Emerald Ally wrote:
    Excellent Idea! I did as you said and I get the following error;

    Compiling... antsimplea.cpp C:\VC++ Tutorial\Ant2\antsimplea.cpp(350) : error C2065: 'MAXINT' : undeclared identifier Error executing cl.exe.

    The line its used in is as follows;

    [code]int minfit = MAXINT;[/code]

    Im guessing here but it looks like some kind of constant.

    Any ideas In the meantime im going to search http://msdn.microsoft.com for relevant constants.

    The VC++ equivalent there would be INT_MAX



  • BCras

    The first step as you suggest is be able to port the existing code to VC++.

    Do you have the file mem.h on your machine If not then you probably need to use the similar methods as the ones in memory.h. Take a look at http://msdn2.microsoft.com/en-us/library/dswaw1wk(VS.80).aspx

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Newkid

    Excellent Idea! I did as you said and I get the following error;

    Compiling... antsimplea.cpp C:\VC++ Tutorial\Ant2\antsimplea.cpp(350) : error C2065: 'MAXINT' : undeclared identifier Error executing cl.exe.

    The line its used in is as follows;

    [code]int minfit = MAXINT;[/code]

    Im guessing here but it looks like some kind of constant.

    Any ideas   In the meantime im going to search http://msdn.microsoft.com for relevant constants.

  • Hikmer

    Emerald Ally wrote:
    I have used the memory.h header as an include instead of mem and it seems to do the trick. However there is another header called values.h that was causing problem. I then had an idea. I browsed through the Borland compiler include directory and took the values.h file from there and then instead of placing it in the same directory as my project I placed it into include directory of the MCV++ folder. It worked and now the program compiles without any problems.

    Thank you so much for your help. I havent managed to do what I wanted to yet, however this is was a big obsticle. Again, thank you for you help.

    It might work for now - but it's never a good idea to mix Borland header files with VC++ header files! If I were you, I'd so some extensive testing to make sure it's alright before going ahead.



  • ofir

    I have used the memory.h header as an include instead of mem and it seems to do the trick. However there is another header called values.h that was causing problem. I then had an idea. I browsed through the Borland compiler include directory and took the values.h file from there and then instead of placing it in the same directory as my project I placed it into include directory of the MCV++ folder. It worked and now the program compiles without any problems.

    Thank you so much for your help. I havent managed to do what I wanted to yet, however this is was a big obsticle. Again, thank you for you help.


  • MaryJaneF

    One of the tricks is that you can just remove the including part of value.h from your code and see what methods the compiler will complain about.

    Hope this helps!

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Blueshark006

    Emerald Ally wrote:
    I found a description of the values.h file on a site as follows;

    `values.h'
    A collection of constants defining the numbers of bits in builtin types, minimum and maximum values, and the like.


    Does this mean anything to anyone What header file does visual c++ have that I can use to replace this

    Looks like the VC++ header file most similar to Borland's values.h would be limits.h.



  • How do you develop an interface for an existing C++ program?