( OS and Version: Ubuntu 18.4 , VS Code Version: Vscode 1.4 ,C/C++ Extension Version:0.26)
Hello, I have read all the articles about "raise.c" and none of them solved my problem, I just wrote a simple OpenCV code which captures webcam's frames. each time I run my code it frequently shows an error. the error message is:
Unable to open 'raise.c': Unable to read file (Error: File not found (/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/raise.c)).
launch.json is:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++ build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++ build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
and tasks.json is:
{
"tasks": [
{
"type": "shell",
"label": "g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"`pkg-config",
"--libs",
"--cflags",
"opencv4`"
],
"options": {
"cwd": "/usr/bin"
}
}
],
"version": "2.0.0"
}
So How can I solve this problem? is there any way to solve it. I am a beginner programmer.
and the second problem is each time I run this code my webcam freezes and I have to use "force quite "bottom. why my webcam freezes? any ideas are welcome. thanks. (I am using ubuntu and my IDE is Vscode )
Finally, I found the solution after 3 days of working. I am writing a solution for the next generation. There is no need to search on the internet you can't find anything :D
okay if you want to solve the problem you need to reinstall OpenCV again and turn all flags off. it's a bug. the flags which I used for are:
cmake -D BUILD_TIFF=ON -D WITH_CUDA=OFF -D ENABLE_AVX=OFF -D
WITH_OPENGL=ON -D WITH_OPENCL=OFF -D WITH_IPP=OFF -D WITH_TBB=ON -D
BUILD_TBB=ON -D WITH_EIGEN=OFF -D WITH_V4L=OFF -D WITH_VTK=OFF -D
BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D CMAKE_BUILD_TYPE=RELEASE -D
CMAKE_INSTALL_PREFIX=/usr/local -D
OPENCV_EXTRA_MODULES_PATH=./../opencv_contrib/modules ..
fill OPENCV_EXTRA_MODULES_PATH
and CMAKE_INSTALL_PREFIX=/usr/local
with the correct path!
that's all, good luck.
This error can occur when using the gdb debugger. In such case you need to include the '-g' flag in your compile command. (this solved the error that brought me here)
Your compile command may be similar to below:
g++ -Wall -Werror -std=c++14 -g -O -o <executable> <fileName>
Also noting the program path that works for me in launch.json:
"program": "${workspaceFolder}/<executable>"
If you just want to not see the prompt about the missing file every time, you can create that directory and place an empty file there (path adjusted for what I see currently here):
sudo mkdir -p /build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/
sudo touch /build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/raise.c
If you want to see some source while debugging, you can place the file for the version of glibc you are using there. Find the tag corresponding to the version in your error path in an online repository and get it from there. Your version being glibc-2.27
and mine being glibc-2.31
. Mine is here: https://github.com/bminor/glibc/blob/glibc-2.31/sysdeps/unix/sysv/linux/raise.c
So I can grab it as follows:
pushd ~/temp
wget https://raw.githubusercontent.com/bminor/glibc/glibc-2.31/sysdeps/unix/sysv/linux/raise.c
sudo cp -a raise.c /build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/
There's probably a way to tell VSCode / gdb to find it from some other path without messing with your root filesystem. Please anyone edit if they know how to do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With