khartmansjsu / MOC-Linux

repository for the re-design of Tharen Rice's Microsoft Visual C++ MOC package
Other
0 stars 0 forks source link

Get MOC_GridCalc_BDE.cpp to compile #1

Open khartmansjsu opened 2 years ago

khartmansjsu commented 2 years ago

Goal: compile MOC_GridCalc_BDE.cpp

Summary

So far I have commented out a number of include statements which are to Windows-specific header files. The latest Attempt at compiling (see below) resulted in a large number of errors stemming from both the main file being compiled and a number of its dependencies. I am currently in the process of determining if those dependencies are still worth keeping. It seems that MOC_GridDlg.h is not entirely necessary (it defines many classes for Windows-specific dialogue boxes), but it has some hard-coded values in those classes. I need to find out if these values need to be re-defined in the main script, MOC_GridCalc_BDE.cpp once I remove the include call to MOC_GridDlg.h.

Attempt 1:

[khartm12@integrity MOC_Grid_BDE]$ gcc MOC_GridCalc_BDE.cpp -o MOCGridCalc_BDE_test
In file included from MOC_GridCalc_BDE.h:34,
                 from MOC_GridCalc_BDE.cpp:30:
Chart.h:9:10: fatal error: afxwin.h: No such file or directory
    9 | #include "afxwin.h"
      |          ^~~~~~~~~~
compilation terminated.
[khartm12@integrity MOC_Grid_BDE]$

Attempt 2:

[khartm12@integrity MOC_Grid_BDE]$ gcc MOC_GridCalc_BDE.cpp -o MOCGridCalc_BDE_test
MOC_GridCalc_BDE.cpp:32:10: fatal error: afx.h: No such file or directory
   32 | #include "afx.h"
      |          ^~~~~~~
compilation terminated.
[khartm12@integrity MOC_Grid_BDE]$

Attempt 3:

[khartm12@integrity MOC_Grid_BDE]$ gcc MOC_GridCalc_BDE.cpp -o MOCGridCalc_BDE_test

MOC_GridCalc_BDE.cpp:39:10: fatal error: Resource.h: No such file or directory
   39 | #include "Resource.h"
      |          ^~~~~~~~~~~~
compilation terminated.
[khartm12@integrity MOC_Grid_BDE]$

Note/context: A number of custom header files have a lowercase leading character in their names while their respective include statements have an uppercase.

Attempt 4:

See: compile_errors1.txt Description: A lot of type errors in Chart.h for the following:

  1. BOOL
  2. COLORREF
  3. CBitmap
  4. CString
  5. CDC
  6. CPoint
  7. CRect
  8. CFont
  9. afx_msg
  10. DECLARE_MESSAGE_MAP() A lot of errors in MOC_GridDlg.h
  11. DECLAR_DYNAMIC()
  12. Syntax error with CWnd*
  13. CEdit
  14. CButton
  15. CComboBox
  16. afx_msg
  17. DECLAR_MESSAGE_MAP() no type and syntax error
  18. AfxMessageBox not declared errors in MOCPlotDialog.h
  19. No declaration of CDataExchange
  20. Syntax errors
  21. DECLARE_MESSAGE_MAP no type errors in MOC_GridCalc_BDE.cpp are numerous an probably can be handled by addressing the above issues. Let's see...
khartmansjsu commented 2 years ago

Notes on MOC_GridCalc_BDE.cpp

khartmansjsu commented 2 years ago

Plan of action

The MOC_GridCalc_BDE.cpp file contains the definitions of class methods that do the method of characteristics calculations. Similarly, the MOC_GridCalc_BDE_IO.cpp file contains he definitions of class methods that output all the calculation results. This is an indication that we need to have some main.cpp script which includes the aforementioned MOC_GridCalc method definitions and makes calls to them. These calls would have normally been made in a GUI.

Let's look at an example. The method MOC_GridCalc::CalcMOC_Grid is defined in MOC_GridCalc_BDE.cpp. We ask ourselves, "Where, outside of MOC_GridCalc method functions, is this method ever called?" The answer is, "Nowhere. This is a private method function." Verification:

[khartm12@integrity Three-Dimensional-Nozzle-Design-Code-master]$ grep -rnw './' -e 'CalcMOC_Grid'
./MOC_Grid_BDE/MOC_GridCalc_BDE.h:109:          int CalcMOC_Grid( double g, double pAmb, int tFlag, double mThroat, int nType,
./MOC_Grid_BDE/MOC_GridCalc_BDE.cpp:158:        else flag = CalcMOC_Grid(gamma_i, pAmbient, throatFlag,
./MOC_Grid_BDE/MOC_GridCalc_BDE.cpp:171:int MOC_GridCalc::CalcMOC_Grid( double g, double pAmb, int tFlag, double mT, int nType,
[khartm12@integrity Three-Dimensional-Nozzle-Design-Code-master]$

Okay, so ask ourselves this, "Where in the Public functions is the method MOC_GridCalc::CalcMOC_Grid called?" The answer is above: line 158 of MOC_GridCalc_BDE.cpp. This is in the public method function below (line 154):

int MOC_GridCalc::CreateMOCGrid(void)
{
        int flag = 0;
        if ( nC < 5) AfxMessageBox("Increase the number of starting characteristics > 5");
        else flag = CalcMOC_Grid(gamma_i, pAmbient, throatFlag,
                mThroat, nozzleType, designParam, nozzleGeom, nSLi, nSLj);
        return flag;
}

Ask another question: "Where in the code base is the method MOC_GridCalc::CreateMOCGrid called?

[khartm12@integrity Three-Dimensional-Nozzle-Design-Code-master]$ grep -rnw './' -e 'CreateMOCGrid'
./MOC_Grid_BDE/MOC_GridDlg.cpp:540:     flag = moc->CreateMOCGrid();
./MOC_Grid_BDE/MOC_GridCalc_BDE.h:61:           int CreateMOCGrid(void); // This is the main control function
./MOC_Grid_BDE/MOC_GridCalc_BDE.cpp:154:int MOC_GridCalc::CreateMOCGrid(void)
[khartm12@integrity Three-Dimensional-Nozzle-Design-Code-master]$

Here we have its declaration in MOC_GridCalc_BDE.h on line 61, its definition in MOC_GridCalc_BDE.cpp on line 154, and a call to it on line 540 of MOC_GridDlg.cpp. This seems consistent with the nature of the original software package (all calculations are initiated and sent from a GUI. Time to investigate MOC_GridDlg.cpp, as this file will likely give hints about how to write the new main.cpp file which will be used for compilation of this package on linux systems.

khartmansjsu commented 2 years ago

Goal: compile MOC_GridDlg.cpp

Summary

Changelog:

Attempt 1:

[khartm12@integrity MOC_Grid_BDE]$ g++ MOC_GridDlg.cpp -o MOC_GridDlgTest
MOC_GridDlg.cpp:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
[khartm12@integrity MOC_Grid_BDE]$

Attempt 2:

[khartm12@integrity MOC_Grid_BDE]$ g++ MOC_GridDlg.cpp -o MOC_GridDlgTest
MOC_GridDlg.cpp:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
[khartm12@integrity MOC_Grid_BDE]$ g++ MOC_GridDlg.cpp -o MOC_GridDlgTest
In file included from MOC_GridDlg.cpp:5:
MOC_Grid.h:12:3: error: #error include 'stdafx.h' before including this file for PCH
   12 |  #error include 'stdafx.h' before including this file for PCH
      |   ^~~~~
MOC_GridDlg.cpp:14:10: fatal error: direct.h: No such file or directory
   14 | #include "direct.h"
      |          ^~~~~~~~~~
compilation terminated.
[khartm12@integrity MOC_Grid_BDE]$

Attempt 3:

see compile_errors2.txt tons of compile time error, unrelated to missing header files or undeclared header files.