|
[Sponsors] |
[OpenFOAM.org] Build OPENFOAM from Source and Debug with VisualCode |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 14, 2022, 11:47 |
Build OPENFOAM from Source and Debug with VisualCode
|
#1 |
New Member
Claudia
Join Date: Dec 2022
Posts: 2
Rep Power: 0 |
Hello,
Season's greetings! Can someone please help me with setting up the openfoam repository in visual studio code or any other opensource IDE. I wish to debug into the source code repository with my added functions. Any lead or step-by-step process to do this will be appreciated. Thanks |
|
December 16, 2022, 18:03 |
|
#2 |
Member
Ali B.
Join Date: Mar 2020
Location: abzrg.github.io
Posts: 44
Rep Power: 6 |
Hello Claudia
First compile OpenFOAM in debug mode. For that you have to set the following environment variable to Debug in $WM_PROJECT_DIR/etc/bashrc before compiling OpenFOAM Code:
# [WM_COMPILE_OPTION] - Optimised(default), debug, profiling, other: # = Opt | Debug | Prof export WM_COMPILE_OPTION=Opt # change this to Debug Then you have to install VSCode and the C/C++ extension (from MicroSoft)... Now, load OpenFOAM environment and open the VSCode in the root of your project, Code:
cd path/to/my/project of22 # or your version of Foam code . Hover over one of the missing header files and click on the "Quick Fix..." and then click on the "Edit includePath settings". It will open a tab + create a .vscode directory in the root of the workspace. Close the tab! Open the file [font=courier]c_cpp_properties.json[font] and edit it as follows Code:
{ ... "includePath": [ "${workspaceFolder}/**", "${env:FOAM_SRC}/**" ], ... } If you have any other directories that contain source code, you can also put them here. for example Code:
{ ... "includePath": [ "${workspaceFolder}/**", "${env:FOAM_SRC}/**", "${env:WM_PROJECT_USER_DIR}/src/**", "${env:WM_PROJECT_USER_DIR}/applications/solvers/mySolver/" ], ... } If you also want to run & debug your code in VSCode, you can follow links below, Last edited by reverseila; December 26, 2022 at 12:44. |
|
December 17, 2022, 00:48 |
|
#3 |
New Member
Claudia
Join Date: Dec 2022
Posts: 2
Rep Power: 0 |
Hi reverseila! On it
Thank you so much for the details. Really appreciate it. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to develop OpenFOAM with CMake and popular IDEs | cosscholar | OpenFOAM Programming & Development | 0 | March 16, 2022 16:17 |
OpenFOAM 4.0 Released | CFDFoundation | OpenFOAM Announcements from OpenFOAM Foundation | 2 | October 6, 2017 06:40 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |
UDF Scalar Code: HT 1 | Greg Perkins | FLUENT | 8 | October 20, 2000 13:40 |
UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 11, 2000 04:43 |