Subj : mixing c/c++ (revised) To : borland.public.cpp.borlandcpp From : "Rob" Date : Thu Jul 17 2003 05:25 pm In this program, C++ passes to C which initializes the char array [C++ does it way different than C!], returns to C++ and is passed to another C which “cats” onto that same char array, which then returns and C++ which prints it in a window. (I have a second question, too. I can set a breakpoint in my program, and then step throuth the program, but how do I watch the values of particular variables????) Info :Making... Info :Building... Info :Compiling C:\BC5\EXAMPLES\OWL\TUTORIAL\initvars.c Info :Compiling C:\BC5\EXAMPLES\OWL\TUTORIAL\addtoend.c Info :Compiling C:\BC5\EXAMPLES\OWL\TUTORIAL\step01.cpp Error: step01.cpp(64,3):Could not find a match for 'TFrameWindow::TFrameWindow(int,string,TDrawWindow *)' ------------------------- step01.cpp ------------ #include #include #include extern "C" int AddToEnd( string *AddString ); extern "C" int InitVars( string *AddString ); string AddString = "This is C++, and this is C " ; class TDrawWindow : public TWindow { public: TDrawWindow(TWindow* parent = 0); protected: // Override member function of TWindow bool CanClose(); // Message response functions void EvLButtonDown(uint, TPoint&); void EvRButtonDown(uint, TPoint&); DECLARE_RESPONSE_TABLE(TDrawWindow); }; DEFINE_RESPONSE_TABLE1(TDrawWindow, TWindow) EV_WM_LBUTTONDOWN, EV_WM_RBUTTONDOWN, END_RESPONSE_TABLE; TDrawWindow::TDrawWindow(TWindow* parent) { Init(parent, 0, 0); } bool TDrawWindow::CanClose() { return MessageBox("Do you want to save?", "Drawing has changed", MB_YESNO | MB_ICONQUESTION) == IDNO; } void TDrawWindow::EvLButtonDown(uint, TPoint&) { MessageBox("You have pressed the left mouse button", "Message Dispatched", MB_OK); } void TDrawWindow::EvRButtonDown(uint, TPoint&) { MessageBox("You have pressed the right mouse button", "Message Dispatched", MB_OK); } class TDrawApp : public TApplication { public: TDrawApp() : TApplication() {} void InitMainWindow() { InitVars( &AddString ); AddToEnd( &AddString ); //<-- C code [ ********** Here is the problem. ********** ] At this point AddString holds a value. AddString must be passed to SetMainWindow(); (like below) instead of the string "Sample ObjectWindows Program", but then SetMainWindow(); gets screwed up and I get an error. ** my way ** SetMainWindow(new TFrameWindow(0, AddString, new TDrawWindow)); ** example’s way ** SetMainWindow(new TFrameWindow(0, "Sample ObjectWindows Program", new TDrawWindow)); } }; int OwlMain(int /*argc*/, char* /*argv*/ []) { return TDrawApp().Run(); } ----------------------------- Initvars.c -------- #include #include int InitVars( char *AddString ) //Initialize Variables { //89 strcpy( AddString, "This is C++,"); return (0); } //89 -------------------------------- AddToEnd.c ------------ #include #include int AddToEnd( char *AddString ) { //89 char message[] = " and this is C "; strcat( AddString, message ); return (0); } //89 ------------------------------------------ .