Debug assertion failed opencv xmemory0 C++ - c++

I try to run the code from calibration, and i'm stuck with this error:
Debug Assertion Failed!
Program:
C:\Users\openCV\Desktop\Git\AzTest\Debug\AzTest.exe
File: c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0
Line: 94
Expression: "_Count <= (size_t)(-1) / _Sz" && 0
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
To be honest I don't know what else should I do, or why is this error happening.
What is to be noted is that the code used to work on the same PC.
I've modified the code (when it worked, and it worked after I done the changes), code can be found here (The project is there, also it is configured for having the OpenCV directory on C:\opencv.

After hours of digging I found the answer. It was a miss configuration imported from another project.
*Project properties -> Linker -> Input -> Additional Dependencies:
opencv_ts300d.lib;opencv_world300d.lib;; (the right way for opencv3).
Mine was:
opencv_ts300d.lib;opencv_world300.lib;
Afterwards I get intro "missing MSVCR120D.dll", I fixed that by changing the opencv version to OpenCV310.
Tried to fix that missing dll problem by uninstalling and reinstalling all the redistributable that I could find on Microsoft website.
Also if you will have "opencv_world310d.dll" missing, just copy&paste it into the project release/debug folder.

Related

Visual Studio 2019 CVT1101 & LNK1123 fatal error

this is my first time using visual studio after reinstall windows and stuff which happened around a year ago, and whenever i tryto compile, i get this error,
1>------ Build started: Project: TrainerBasic, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
1>CVTRES : fatal error CVT1101: cannot open 'C:\Users\gamz\AppData\Local\Temp\lnk{E3BAB312-249D-4367-A832-80B6F6B34AFB}.tmp' for reading
1>Done building project "BasicProgram.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
So, i don't have an antivirus software, my hardware is not full, i tried cleaning the solution.. i don't know what could be the problem... and i really want to get back to visual studio, as any other online compilers don't have windows.h for example. I ALSO TRIED TO USE THE REPAIR FUNCTION IN VISUAL STUDIO. P.S. I am using visual studio community 2019
Linker Tools Error LNK1123:
Input files must have the Common Object File Format (COFF) format. If
an input file is not COFF, the linker automatically tries to convert
32-bit OMF objects to COFF, or runs CVTRES.EXE to convert resource
files. This message indicates that the linker could not convert the
file. This can also occur when using an incompatible version of
CVTRES.EXE from another installation of Visual Studio, the Windows
Development Kit, or .NET Framework.
I suggest you could follow the following methods to fix the issue:
1,Try building with incremental linking disabled.Property->Linker. Change the value of Enable Incremental Linking to No.
2,Try turning off the Embed Manifest option.Property-> Manifest Tool->Input and Output. Change the value of Embed Manifest to No.
3,Verify that the version of CVTRES.EXE found first in your PATH environment variable matches the version of the build tools, or the version of the Platform Toolset, used by your project.
For more details I suggest you could refer to the Doc:https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1123?view=vs-2019
According to the Doc
The Visual Studio compilers and build tools can report many kinds of
errors and warnings. After an error or warning is found, the build
tools may make assumptions about code intent and attempt to continue,
so that more issues can be reported at the same time. If the tools
make the wrong assumption, later errors or warnings may not apply to
your project. When you correct issues in your project, always start
with the first error or warning that's reported, and rebuild often.
One fix may make many subsequent errors go away.
As far as I'm concerned, after you fix link1123 error, CVTRES errors and warnings may go away.

Visual studio compiling failed without any errors [duplicate]

I have a WebApplication which contains reference to WCF services.
While building using Visual Studio 2010, Build fails without any error or warning. However building the .csproj using MsBuild is successful.
Can't figure out what should I try in Visual Studio, to resolve / diagnose the issue. Can you please help out?
I find out that the build has been failing,
From text displayed in status Bar.
From output window:
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
The output tab includes configuration details.
------ Build started: Project: <projectName here> Configuration: Debug Any CPU
I noticed that if "Build + Intellisense" is selected in the Error List, it causes the error messages to be swallowed.
Change this option to "Build Only", and all error messages will be displayed:
I don't know if this is a bug in Visual Studio or what, but it certainly revealed hidden error messages that were the key to pinpointing the failure for me.
Some, like Richard J Foster, have suggested increasing the "MSBuild project build output verbosity" setting to "Diagnostic" (the highest possible option), but this didn't solve the problem for me, as Visual Studio appeared to be suppressing the error message(s) themselves.
As an alternative, you may try to use the raw output messages from the "Output" tab, which haven't been filtered by Visual Studio. Either do an in-place search for the strings "error" and/or "failed", or copy all of the output to your favorite text editor and do a search there.
To ensure that the Output window appears each time you do a build, you can go to Tools → Options → Projects and Solutions → General, and ensure that the option "Show Output Window when build starts" is checked.
As an additional troubleshooting step, it is also possible to build the project from the PowerShell command line by running dotnet build. This will show you the complete build output, including any errors that Visual Studio may be hiding.
I just ran into a similar situation. In my case, a custom action (from the MSBuildVersioning package available on Nuget.org - http://www.nuget.org/packages/MSBuildVersioning/) which appeared in the csproj file's BeforeBuild target was failing without triggering any error message in the normal place.
I was able to determine this by setting the "MSBuild project build output verbosity" (in the latest Visual Studio's Tools tab [Path: Tools > Options > Build and Run]) to "Diagnostic" as shown below. This then showed that the custom action (in my case HgVersionFile) was what had failed.
Here are some things that you can try:
If your solution contains more than one project, try building each project one at a time. (You may even want to try opening each project independently of the solution.)
If applicable, ensure that all of your projects (including dependencies and tests) target the same version of the .NET Framework. (Thanks to user764754 for this suggestion!)
Tip: Check Tools → Extension and Updates to ensure that your packages are up-to-date.
Ensure that all dependency projects are built to target the same platform as your main project.
Try restarting Visual Studio.
As suggested by Bill Yang, try running Visual Studio as Administrator, if you aren't already. (If you are already running Visual Studio as Administrator, perhaps try the opposite?)
Try restarting your computer.
Try "Rebuild All".
Run "Clean Solution", then remove your *vspscc* and *vssscc* files, restart Visual Studio, and then "Rebuild All".
As suggested by Andy, close Visual Studio, delete the .suo file, and restart Visual Studio.
As suggested by Arun Prasad E S, close Visual Studio, delete the .vs folder in your solution directory, and then re-open Visual Studio. (This folder is auto-generated by Visual Studio and contains cache, configuration settings, and more. More details can be found in these questions: Visual Studio - Deleting .vs folder and https://stackoverflow.com/q/48897191.)
As suggested by MrMalith, close Visual Studio, delete the obj folder in your solution directory, clear your temporary folder, and then re-open Visual Studio.
Delete the hidden .vs folder & restart Visual Studio. That worked for me.
I want to expand on Sasse's answer. I had to target the correct version of .NET to resolve the problem.
One project was giving me an error:
"The type or namespace name 'SomeNamespace' does not exist in the namespace 'BeforeSomeNamespace' (are you missing an assembly reference?)".
There was no error in the Error List window but the assembly had a yellow warning sign under "References".
I then saw that the referencing project targeted 4.5.1 and the referenced project 4.6.1. Changing 4.6.1 to 4.5.1 allowed the overall build to succeed.
Nothing was working for me so I deleted the .suo file, restarted VS, cleaned the projected, and then the build would work.
I tried many things like restarting Visual Studio, cleaning and rebuilding the solution, restarting the PC, etc., but none of them worked for me. I was finally able to solve the problem by doing the following:
First of all, make sure all the projects in your solution (including tests) are targeting the same .NET version. Then:
Save pending changes in the project and close Visual Studio
Find the exact location from file explorer and find "obj" file and open it,
Then, delete all the included files (some files won't remove, it doesn't matter, just skip them).
Use run command (by pressing Windows Key + R) and type "%temp%" and press enter to find temporary files.
Finally, delete them all.
On other possibility is that Visual Studio needs to run as Administrator, this might be related to deploying to local IIS server or other deployment need.
Just for the sake of completion and maybe helping someone encountering the same error again in the future, I was using Mahapps metro interface and changed the XAML of one window, but forgot to change the partial class in the code-behind. In that case, the build failed without an error or warning, and I was able to find it out by increasing the verbosity of the output from the settings:
In my case (VS 2019 v16.11.20), disabling Text Editor->C#->Advanced->Enable 'pull' diagnostics in the options solved the issue.
Double check for _underscore.aspx pages in your project.
I had a page and code-behind:
`myPage.aspx` and `myPage.aspx.vb`
when building the project, I'd get errors on the .aspx.vb page stating that properties defined on the .aspx page didn't exist, even though the page itself would build fine and there were NO OTHER ERRORS showing in the output (even with diagnostic level build output).
I then came across a page in the project that was named the same thing but with an underscore: _myPage.aspx - not sure where it came from, I deleted it, and the solution built fine.

How to fix error with SFML ln VS 2017?

Hi i followed this video to set-up VS2017 for sfml using.
Youtube Video
I did what he says but when i debug project i get this error:
Error MSB6006 "CL.exe" exited with code -1073741515.
I find out on google that this is some sort of compiler error but not how to fix this. Can someone help me or point me to answer?
I'm using Visual Studio 2017 and i downloaded SFML: Visual C++ 14 (2015) - 32-bit
Indeed, you compiler crashed. The status code -1073741515 translates to 0xC0000135 which in turn translates to STATUS_DLL_NOT_FOUND. That is bad. That is not about the SFML dlls, but a library Visual Studio itself uses. Something is very wrong with your Visual Studio installation.
Chances are you will get the same error without using SFML.
I don't know what the tutorial did and I'm not going to watch a video to find out. Your best chance is to do a clean reinstall of your Visual Studio installation and then follow the official guide from the SFML homepage. That works.

Visual studio 2017 error loading rule set file

When I try to view the properties dialog of any project VS2017 spits out a bunch of errors.
"An error occurred while loading the rule set file 'C:/Program
Files(x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis
Tools\Rule Sets\AllRules.ruleset'."
..\BasicCorrectnessRules.ruleset'.
..\DesignGuidelinesRules.ruleset'.
..\ExtendedCorrectnessRules.ruleset'.
..\ExtendedDesignGuidelinesRules.ruleset.'
..\GlobalizationRules.ruleset'.
..\ManagedMinimumRules.ruleset'.
..\MinimumRecommendedRules.ruleset'.
..\MixedMinimumRules.ruleset'.
..\MixedReccommendedRules.ruleset'.
..\NativeMinimumRules.ruleset'.
..\NativeReccommendedRules.ruleset'.
..\SecurityRules.ruleset'.
I don't know why this started happening, I didn't change anything in the install directory. All of those files are there in the directory, not sure why they are causing errors. Anyone know the cause?
Bottom line: I had the same problem. I had to do a repair install of Visual Studio 2017 to make this work properly. I tried just upgrading to Version 15.4.5 (from 15.4.4), but it didn't resolve the problem.
The problem didn't track the solution being used. I have two computers - one worked with the solution, the other failed with identical files. I copied the 'rules' files from the working computer to the failed one - no joy. On the working computer, I updated VS successfully (to 15.4.5), but on the failing computer I couldn't get the update to work (see Visual studio 2017 installer won't run after extracting). Once I resolved the problem noted in the other link and updated to 15.4.5, I still had to do a 'repair install' (from Add/Remove Programs) to completely resolve the problem.

The file MSVCP100D.dll is missing from the computer

What I'm having is that this error is displayed when I wanted to copy a exe debug project that I have created (which works witout any problems) to another machine (the error message is displayed).
According to the question posted previously, the best solution to get rid of the error message is to make a release and not a debug in the Configuration Manager.
Doing that, and when rebuilding the project with the RELEASE one, I'm having new errors in my project which were not included when doing the DEBUG.
For instance, one of them is :
Error 2 error C1083: Cannot open include file: 'opencv\highgui.h': No such file or directory c:\...\projects\...\ex\opencv.h 4
23 IntelliSense: identifier "IplImage" is undefined c:\...\ex.cpp 80
Any feedbacks?
You've probably added include paths for OpenCV to your project file. Unfortunately, Visual Studio by default makes such changes ONLY to the active configuration, which in your case was debug.
This rarely makes sense. Adding a logging library would be such a rare case, but you probably needs OpenCV in both debug and release builds.
MSVCP100.dll is part of the Microsoft Visual Studio 10 runtime. MSVCP100d.dll is the debug build of the same dll - useful for running your program in debug mode.
http://www.microsoft.com/en-us/download/details.aspx?id=5555
Basically it is a relatively new package and is not guaranteed to be on all systems, especially Windows XP, so you can distribute the required DLL files or the entire runtime with your program. EDIT: Keep in mind that debug builds are not meant to be distributed, so your program should not contain debug dll-s either such as MSVCP100d.dll.
Try downloading it, and then see what happens.
Also check out this question.
MSVCP100D.dll and MSVCP100.dll is part of the Microsoft Visual Studio 10 runtime, so if someone compile her/his programs with this package, then uninstall the package and install another one for example Microsoft Visual Studio 12 (2013).
When trying to run her/his programs , then her/his will get the message that 'so and so... try to reinstalling the program to fix this problem'. this means you have to reinstall Microsoft Visual Studio 10.
the other way is to recompile your programs under the new package!