It works!
I follow your scheme, adding add_executable( test test_lance.cpp)
in the end of CMakeLists.txt, then I make
and run ./test
, the cpp file is successfully excuted.
However, I suffer the same error when I want to run the “simple-real-numbers.cpp” example in VS Code editor.
/usr/bin/g++ -fdiagnostics-color=always -g /home/lance/code/cpp_test/test_lance.cpp -o /home/lance/code/cpp_test/test_lance
/home/lance/code/cpp_test/test_lance.cpp:38:10: fatal error: openfhe.h: No such file or directory
38 | #include "openfhe.h"
| ^~~~~~~~~~~
compilation terminated.
According to official document, I add following comments in setting.json
:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include/openfhe/core", // I added these three lines.
"/usr/local/include/openfhe/pke",
"/usr/local/include/openfhe/cereal"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
launch.json
is:
takes.json
is:
{
"tasks": [
{
"label": "buildCmake",
"type": "shell",
"command": "cd build && rm CMakeCache.txt && cmake .. -DCMAKE_BUILD_TYPE=Debug && make",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}
How I fix this problem?