debugging openCV in visual studio 2005 - c++

I am new to Visual Studio 2005 and am trying to get to grips with it. I am using it to compile and debug an application called AAM-library (which I didn't write) which uses OpenCV 1.0. I have compiled the software and now I'm getting a runtime error.
To figure out the reason for the error (I know the line number and file name that generates the error, since the runtime error tells me) I want to step through the code in the few lines before the error. The error is in an openCV file called opencv/cv/src/cvshapedescr.cpp. To debug I have figured out that I can step through from the start of the program using F11 or F10 but this is taking forever to reach the error. Is there a way to get straight to the error? I'm trying to put a breakpoint in the openCV file, but this is not part of the workspace that I am working on, and so it doesn't seem to be having an effect.

Place a breakpoint a few lines before the error or use run to cursor. There is no magical "10 lines before this breakpoint" feature. (Intellitrace can do this for managed code but that's a whole different ballgame)
Also note that concurrent debugging was made a LOT better in VC2008, you might want to consider using a more recent compiler, such as VC2008 or VC2010.

Related

Vscode doesnt show errors on the IDE like other IDEs such as (visual studio 2019, repl.it, etc.)

so I recently got started with vscode and working with the c++ project when I noticed that some of the errors aren't displaying. Also, the program would run fine on vscode but when used it on repl.it it would show some critical errors like "signal: Aborted (core dumped)" and it would tell me at which line it encountered that problem.
Looking at vscode however it seems to me it doesn't detect subtle errors such as when I have a function that would return a string and I purposely return 0 instead of a string it still considers it a valid operation. I don't know if the issue is the IntelliSense or some error-checking aspects, but one thing for certain I know visual studio would show this with a warning sign that would appear on the number line.
I do have the squiggly lines enabled for errors and it does show errors if I have some keyword typed incorrectly. What I want to know is where the c++ would fail to run and tell me before the run, or even during runtime.
screenshot of no error when there should be
VSCode is pretty intelligent, and in theory it should be able to have all the IntelliSense that those other IDEs have. However, that does not come out of the box. What you need to do it install some extensions specific to the programming / scripting languages that you work with. For example, for C++ you can download C/C++ extension developed by Microsoft.
After installing the needed extensions please read some documentation and tweak them as needed.
Your IntelliSense issues will be solved.
I've figured out that it wasn't displaying the crash errors because my installation of msvc was flawed. I downloaded msvc again and used the Pacman commands to install all the necessary files and now my crash errors show. However, some syntax errors still don't show like int main {... without a closing curly brace. This code still runs, and the error is picked up during the run time. I would've expected the error to be highlighted before the run.

Visual Studio Code First C++ Project

I'm investigating using VS Code for our current C++ project on Linux (using gcc to compile). Though I'm familiar with Visual Studio, Visual Studio Code is a different beast. I'm just trying to get a sample C++ app up in it, but even following this simple tutorial has proved fruitless.
It all falls apart early on. I have a one file program open. When I bring up the command palette, I don't have the "Tasks: Configure Task Runner" task. Since all the following steps depend on this one, I don't know how to proceed.
Was that command removed? Is there a better/more current step-by-step guide? I've heard great things about VS Code and really want to get it working.

opencv assertion failed (matrix.cpp line 508)

I have used visual studio 2015 express to compile a program which can be successfully run in my first computer. Then I tried to move the dll files needed to run the program and the exe file generated by vs to another computer which didnt install vs 2015 and opencv library.
However, the program can only be run in the half way and will have error shown in the below picture when doing opencv functions declared inside the program.
What's wrong with the program? Would you mind giving me any suggestion to fix it?
Thanks!!
https://drive.google.com/file/d/0B9_vlz2OS7h9Q1JTSHQ1MUVQazg/view?usp=sharing
One (or more) of those conditions in the assert statement is returning false. Suggest commenting them out one by one and see which one is causing the problem.
You could also just remove the assert statement (typical when in production) and test the program's behavior.
The problem should not be the missing vs 2015.
It looks like an exception thrown by the constructor of the Region of interest (cv::roi i think?). You are trying to create a roi that is either bigger then the original image or you are trying to make a roi with negativ with or height.

Why won't Allegro initialize?

I tried installing allegro 5 to code blocks, but even though it seems the program compiles it won't initialize. I get an error saying the application failed to start because allegro-5.0.9-monolith-md-debug.dll was not found. It also says re-installing may help, but I've tried that several times already. I tried following online tutorials, but I still get this error. Am I doing something wrong? Please help.
Copy allegro-5.0.9-monolith-md-debug.dll into the same directory as your source code. I had this same exact problem. I was using Visual C++ 2010 express edition, paste it with the source not the .exe if you are running it from within the compiler, if you want to run it outside of the compiler it will need to in the same location as the .exe

Tried to embed python in a visual studio 2010 c++ file, exits with code 1

I am trying to embed some python code in a c++ application i am developing with ms visual studio c++ 2010. But when i run the program, it exits with code 0x01 when i call Py_initialize().
I dont know how to find out what went wrong. the help file says, Py_Initialize can't return an error value, it only fails fataly.
But, why did it fail?
I am using a self-compiled python27_d.dll, which i created with the msvs project files in the source downloads from python.org.
Is there simple 'hello world' type example of the Py_Initilize code in the python sdk you can start with?
That will at least tell you if you have the compiler environment setup correctly, or if the error is in your usage.
Well, i finally found out what went wrong.
I did compile my python27_d.dll with the same VC10 as my program itself.
But my program is normally compiled as 64 bit executable. I just forgot to compile the dll for x64, too. I didnt think this would lead to such annoying behavoiur, as i believed i would get a linkr error then.