Open khartmansjsu opened 2 years ago
lines 503-547
of MOC_GridDlg.cpp
as a template for a main.cpp
file which will launch this whole MOC code on a linux system. It will make the call to the CreatMOCGrid function which sets into motion the calculation of the method of characteristics grid.
Goal: compile MOC_GridDlg.cpp
Summary
Changelog:
line 4
ofMOC_GridDlg.cpp
, comment out dependency onstdafx.h
At first glance, and referring to the last comment on this issue (where CreatMOCGrid is seen to be called from only 'MOC_GridDlg.cpp
on line 540), I identify a function method of the class CMOC_GridDlg, CMOC_GridDlg::OnCalcMOCBUTTON(). CreatMOCGrid is called from within this function. Additionally, this appears to be the only block of code thus far which could be run standalone, with the replacement of some lines of code, such as line 517, where AfxMessageBox() is used to print a fatal error message. I think that amain.cpp
script which contains a form of lines 503-547 is a good path to take in implementing the above plan of action. Still, I will go through the steps to remove dependencies ofMOC_GridDlg.cpp
on packages which cannot exist in linux. Attempts 1 - ___ itemize these steps.Attempt 1:
line 4
ofMOC_GridDlg.cpp
, comment out dependency onstdafx.h
stdafx.h
is another Windows MFC library. It doesn't exist, and we don't want it to in order for this code to compile.Attempt 2:
stdafx.h
, but the issue is coming fromMOC_Grid.h
now instead ofMOC_GridDlg.cpp
.line 5
ofMOC_GridDlg.cpp
, comment out the include statement forMOC_Grid.h
.MOC_Grid.h
is the main header file for the application, but doesn't appear to contain any important code blocks for calculations of MOC contours or streamlines, etc. Rather, it declares a class CMOC_GridApp of type CWinApp. While this is useful for the GUI and application, it is not necessary for the linux version we are developing. Remove it.line 14
ofMOC_GridDlg.cpp
, comment out the include statement fordirect.h
.direct.h
does not exist in any of this package's three subdirectories. This is why the compiler does not find it. Here, we see some stackoverflow contributors citing wikipeadia thatdirect.h
is a Microsoft Windows specific header file, the utilities of which replaced by includingunistd.h
in a linux system. I will not do this just yet. I want to first confirm thatdirect.h
is being used in a way thatunistd.h
can also be used.Attempt 3:
see compile_errors2.txt tons of compile time error, unrelated to missing header files or undeclared header files.
The plethora of compile-time errors further supports the idea that I should try to extract
lines 503-547
from MOC_GridDlg.cpp and make a script which can run in linux, not requiring all the windows dependencies that pop up in the header files' function declarations. There will undoubtedly be more windows dependencies buried in the aforementioned lines of code, but it will at least be a smaller code base to start, and will still ultimately generate output files as the original code does.Originally posted by @khartmansjsu in https://github.com/khartmansjsu/MOC-Linux/issues/1#issuecomment-1106734644