Problem with cxcore210.dll - visual-studio-2010

I am trying just a basic program with OpenCV with the following code:
#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = cvLoadImage("give-back-to-society.jpg");
cvNamedWindow("Image:",1);
cvShowImage("Image:",img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
When I run this, I get
The program can't start because cxcore210.dll is missing from your computer. Try reinstalling the program to fix this problem.
However, I can see this DLL. It exists.it is added into my Sys-32 directory already.
I'm using visual studio 2010 ultimate.
sometimes, i get this error as well :
it says it cannot find the exe file.
what shld i do? any help?

Try copying the dll to the application's working directory. That should at least provide a quick fix.
Also use this document for reference: http://msdn.microsoft.com/en-us/library/7d83bc18%28v=VS.100%29.aspx

For this problem follow the below steps
Where ever you have the build path from cmake " build\bin\Debug " Delete all except the dlls
Now Copy these dlls into the Debug folder in your Visual Studio Project
Now Build the solution, This should work !
it worked for me :)

Related

How to fix cb_console_runner.exe failed on CodeBlocks?

I could not run any program in CodeBlocks. When I click to run button, then log tab display this message. I was trying to fix this problem by reinstall codeblocks but It doesn't work. Also search google but can't find any solution.
Executing: C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe "D:\Timus\test.exe" (in D:\Timus)
Execution of 'C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe "D:\Timus\test.exe"' in 'D:\Timus' failed.
Here is my small program
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
I just found a solution from CodeBlocks Forum.
The default install directory for Code Blocks was, C:/Program Files (x86)/codeblocks, which MingW installer did not like due to the 'white spaces' in Program Files (x86).
So reinstall the full codeblocks in different directory with no spaces in its name e.g. C:/codeblocks from C:/Program Files (x86)
And it's now work and my problem is solved.

Using a DLL with Qt in Visual Studio

I'm trying to use a DLL with a Qt project in Visual Studio. Normally to use a DLL, it is put in the program's executable directory. However, after putting the DLL in just about every directory I could think of, it is still not being used by the program. Is there anything extra that I need to do aside from putting the DLL in the executable directory? Thanks.
The dll should be in the working directory of the executable. This is listed under the "Debugging" section of the Project Properties.
Almost all of the Qt plugin directories need to be in a specific folder next to the exe for it to be found (imageformats, platforms, etc).
Another way to find out if you are in the right directory is to add this line to your main.cpp:
#include <QDir>
#include <QDebug>
qDebug() << "Current Directory:" << QDir::currentPath();
Hope that helps.
PS also look at the order of dll search directories for windows. I'll post more later about it. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx#search_order_for_desktop_applications

How to install and use YAML-Cpp

I want to learn YAML (and use it with C++) but i'm stuck trying to setup YAML-Cpp.
Let me explain what i've done so far.
I downloaded the source code (version 0.5.1)
Installed Cmake (for Windows)
Installed the Boost libraries (precompiled for Visual Studio 2010)
EDIT:
Built the solution and the INSTALL project
Then i got two folders on my C drive: include and lib
Then i moved it to another folder on my D drive (maybe it's relevant)
For testing, i created a project in V Express and tried to compile this:
#include "yaml-cpp/yaml.h"
int main()
{
YAML::Emitter out;
out << "Hello, World!";
std::cout << "Here's the output YAML:\n" << out.c_str();
return 0;
}
The new result:
d:\development\yamlcpp 0.51\include\yaml-cpp\node\ptr.h(10): fatal error C1083: Cannot open include file: 'boost/shared_ptr.hpp': No such file or directory
Can somebody please tell me what is the right way to build and configure this library?
It looks like you're not including the proper directory. In Visual Studio, there's an option for the "include directories" - make sure that the include directory for yaml-cpp is listed there.
marlon, you need to download boost-cpp (http://sourceforge.net/projects/boost/files/boost/1.58.0/), compile it and ensure to "include directory" in Visual Studio.

#include <mapix.h> missing Visual Studio 2012

Hi I recently installed Visual Studio 2012 and converting one of my projects that uses the header files:
#include <mapi.h>
#include <mapix.h>
#include <mapiutil.h>
I see the new include directory is at C:\Program Files (x86)\Windows Kits\8.0\Include\um but it only has the mapi.h header file not the other two and I am getting the error cannot open file.
Anyone any ideas? Thanks
It is not part of the Windows SDK, it is available as a separate download.

How do I load the 64-bit Visual Studio Tools Command Prompt?

My development machine is running Windows 7 Ultimate x64. I installed Visual Studio 2010 Ultimate. When I open the Visual Studio Command Prompt (2010), I get the message
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
I have also setup the PowerShell Community Extensions in my Windows PowerShell user profile. And I use the Invoke-BatchFile cmdlet to install the Visual Studio Tools into all my PowerShell sessions
$vcargs = ?: {$Pscx:Is64BitProcess} {'amd64'} {'x86'}
$vcvars = "${env:VS100COMNTOOLS}..\..\VC\vcvarsall.bat"
Invoke-BatchFile $vcvars $vcargs
My vcargs resolves to amd64. I looked in the vcvarsall.bat file for the location of the x64 batch file and got ~dp0bin\amd64\vcvars64.bat. That directory (and file) does not exist.
How do I get the vcvars64.bat file installed properly?
When running in the batch processor, %~dp0 expands to the path where the .bat file is executing. So in the default install for VS2010, that resolves to c:\program files\microsoft visual studio 10.0\vc\bin\amd64\vcvars64.bat. Which is indeed missing, that's a bug they don't seem to be interesting in fixing.
Use "x86_amd64" instead. You'll get the cross compiler, the same one that's used by the IDE.
Install the x64 Components
The problem is an incomplete installation of Visual Studio. I only installed the C# components. I needed to install, at least, the Visual C++ x64 Compilers and Tools.
Adding Components to an Existing Installation
I had problems adding those components to an existing installation. VS2010, especially with SP1 installed, has a ton of bugs around modifying the installation. I encountered some kind of path not found error
I uninstalled SP1 first. I needed the VS2010 installation media on hand (unpack to a directory, insert the real disc, or mount to a virtual drive).
Then I added the VC++ components to the VS installation
Then I was able to reinstall SP1.
I've run into roughly the same problem a number of times. It appears that the structure MS has set up for this is so fragile that installing or removing any software on the same machine (or, apparently, breathing anywhere near that machine) can and will break it. Worse, they have a nearly impenetrable web of batch files invoking each other, that in the end carry out some fairly trivial tasks in what appears to be nearly the most roundabout way possible.
Although I suppose it wastes a bit of memory I decided to simplify my life a bit, and use this:
#include <windows.h>
#include <iostream>
#include <string>
#include <process.h>
void setenv(std::string const &name, std::string const &value) {
SetEnvironmentVariable(name.c_str(), value.c_str());
}
std::string vs_base = "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\";
std::string vc_base = vs_base + "VC\\";
std::string sdk_dir = "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\";
int main(int argc, char **argv) {
char inc_name[] = "INCLUDE";
char lib_name[] = "LIB";
char path_name[] = "PATH";
std::string inc_dir = getenv(inc_name);
std::string lib_dir = getenv(lib_name);
std::string path_dir = getenv(path_name);
inc_dir = vc_base + "include;" + sdk_dir + "include;" + inc_dir;
lib_dir = vc_base + "lib;" + sdk_dir + "lib;" + lib_dir;
path_dir = vc_base + "bin;" + sdk_dir + "bin;" + vs_base + "Common7\\IDE;" + path_dir;
setenv(inc_name, inc_dir);
setenv(lib_name, lib_dir);
setenv(path_name, path_dir);
char path[MAX_PATH];
GetSystemDirectory(path, sizeof(path));
strcat(path, "\\cmd.exe");
_spawnlp(_P_WAIT, path, path, NULL);
return 0;
}
You'll have to adjust the base directories at the top for the locations where you have things installed. One of these days I suppose I should rewrite this to use a separate configuration file (I've pretty much worked out an XML format that should work reasonably well), but this has worked well enough that I haven't bothered to finish that, and since it's for a programmer anyway, doing a trivial modification and re-compile isn't particularly onerous.
I had the problem, where I had visual studio 2010 professional (i'm guessing not SP1, it says "Version 10.0.30319.1 RTMRel" in About), and I also had the problem where in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC folder, it had vcvarsall.bat, but all of the paths that it tried to find any of the other .bat files were invalid, aka I had no other bat files.
I came across this forum post and it was the only thing that solved my problem.
Some people here were also saying "just use SetEnv" but i didn't know where it was because it wasn't in my PATH (typing setenv resulted in 'command not found'), so this is a more complete answer, that i'm posting here so people don't have to struggle like I did for so long
Posting here for archival purposes:
The batch file to set the environment parameters to compile for 64 bit
is contained in the Windows SDK.
After installing the Windows SDK use the following call CALL
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
Or create file C:\Program Files (x86)\Microsoft Visual Studio
10.0\vc\bin\amd64\vcvars64bat with the line above.
Do you have the Microsoft Windows SDK 7.1?
Open your ordinary Visual Studio Command Prompt and type:
setenv /x64
If your 64bit compilers are missing, you might need to read KB2519277.

Resources