OpenCV and VisualStudio 2010 dll problems - visual-studio-2010

Hi everyone I would like to try the openCV library but I have some problems setting up the environment.
From the property Manager I created a new sheet and set:
VC++ Directories :
- Include Directories: $(OPENCV_DIR)\build\x86\vc10\bin and $(OPENCV2_DIR)\build\include
- Library Directories: $(OPENCV2_DIR)\build\x86\vc10\lib;
C/C++ :
- Additional Includes Directories: $(OPENCV2_DIR)\include;
Linker:
opencv_calib3d244d.lib opencv_contrib244d.lib opencv_core244d.lib
opencv_features2d244d.lib opencv_flann244d.lib opencv_gpu244d.lib
opencv_haartraining_engined.lib opencv_highgui244d.lib
opencv_imgproc244d.lib opencv_legacy244d.lib opencv_ml244d.lib
opencv_nonfree244d.lib opencv_objdetect244d.lib opencv_photo244d.lib
opencv_stitching244d.lib opencv_ts244d.lib opencv_video244d.lib
opencv_videostab244d.lib
-Additional Library Directories: $(OPENCV2_DIR)\libs
I can compile but i can't execute the program because I get an error opencv_core242.dll is missing.
Where's my error? Thanks

"I get an error opencv_core242.dll is missing"
if you linked against the libs in opencv\build\x86\vc10\lib (your compiler/linker settings look ok),
you'll have to append
opencv\build\x86\vc10\bin
to your PATH environment variable, so your exe can find the dlls at runtime.

Related

Can't add Embree to my project, getting LNK1104 error

I'm trying to add Embree to an already working solution, following this resource I've added to my CMakeLists.txt file the following:
FIND_PACKAGE(embree 3.0 REQUIRED)
INCLUDE_DIRECTORIES(${EMBREE_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(application ${EMBREE_LIBRARY})
I've also created a Windows environment variable embree_DIR with my Embree installation folder ("C:\Program Files\Intel\Embree3 x64").
CMake configures the solution fine, but when I build I get a fatal error LNK1104: impossible to open 'embree3.lib'.
Just so you know, I actually have a C:\Program Files\Intel\Embree3 x64\lib\embree3.lib file.
Anyone has any clue why this might be happening?
Set EMBREE_ROOT_DIR e.g.:
set(EMBREE_ROOT_DIR "C:/thirdparty/vs2017/x64/embree-2.17.0")
Link to ${EMBREE_LIBRARIES}
target_link_libraries(YourApp
...
${EMBREE_LIBRARIES}
...
)

VS2015 compile errors with Win API GetIscsiSessionList of Iscsidsc.h

I want to user a Windows API called GetIscsiSessionList to get the information of session list.
I came across with a compile problem, VS2015 complains as follows:
VS complians of GetIscsiSessionList:
VS complians in header file Iscsidsc.h:
Iscsidsc.h is in C:\Program Files (x86)\Windows Kits\8.1\Include\um
. Since Iscsidsc.h is a Windows provided file, I don't understand why VS compiler will complain.
The order of include header files should be as follows:
iscsierr.h should be in front of iscsidsc.h

visual studio 2015 c++ sddl.h does not appear as external dependency

I am trying to use the function ConvertSidToStringSid() in a Visual Studio 2015 Community, console project.
According to the msdn page
https://msdn.microsoft.com/en-us/library/windows/desktop/aa376399(v=vs.85).aspx
the requirements are:
Minimum supported client: Windows XP [desktop apps only]
Minimum supported server: Windows Server 2003 [desktop apps only]
Header: sddl.h
Library: Advapi32.lib
DLL: Advapi32.dll
I am using a Windows 10 Home, 64-bit computer. I have the *.lib and *.dll files respectively in :
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64\AdvAPI32.Lib
C:\Windows\System32\advapi32.dll
When i fill in the "#inclucde " in stdafx.h, I get no error from Intellisense. In contrast, "#include <blah.h>" gives a red wiggling underline under the 'include', and a mouse-over says 'Error: Cannot open source file "blah.h"'.
In my .cpp source file, which includes "stdafx.h", I add the code
BOOL OK ... ;
PSID owner;
char *sOwner;
OK = ConvertSidToStringSidW(owner, sOwner);
but then I get the red wiggle under ConvertSidToStringSidW.
In the solution explorer, under the project, under External dependencies there are files SCardErr.h and sdkddkver.h, but nothing, no sddl.h, between these two. (And, by the way, sddkver.h defines _WIN32_WINNT_THRESHOLD 0x0A00. Testing with IntelliSense in the editor, _WIN32_WINNT is also 0x0A00.)
When compiling, I first got an error message that the file sddl.h could not be found. I have multiple copies on the computer, and added to the "Additional include directories" for all configurations, the directory
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared
Compiling still fails with "identifier xxx is undefined" and 'xxx': Identifier not found, from IntelliSense and Build respectively.
The header sddl.h is still not in the external dependencies. Right-clicking on the sdksddkver.h I get its full path: The newly added additional include directory. I don't know what it was before I added this include directory.
Right clicking on the include directive in stdafx.h, I can open sddl.h. The editor shows parts of the contents in a light grey color, when the contents is guarded by an #if/#ifdef directive whose argument is false. However, the function I want to use, ConvertSidToStringSid, is shown in full color.
Unsure if its a clue that the error messages say "defined" rather than "declared". In the project properties, linker, input, additional dependencies, the file advapi32.lib is listed.
What am I doing wrong?
I found the solution myself. The problem was that I had two projects in the same "solution", each with its own stdafx.h file. I had the wrong stdafx.h file open in the editor, and placed the #include directive in the wrong file.
-Thanks

F# Microsoft.ParallelArrays not defined

So I downloaded and installed Microsoft Accelerator v2 to use ParallelArrays. I have referenced it in my project but when I try and execute the code from the module in a script file I get:
"The namespace 'ParallelArrays' is not defined
I have followed the instructions on this post:
Microsoft Accelerator library with Visual Studio F#
I've added a reference to the managed version "Microsoft.Accelerator.dll" to my F# project and then added the native "Accelerator.dll" as an item in my solution and set it's 'Copy To Output Directory' to Copy Always.
Still getting the FSI error and inline error in my script file on the '#load ...' line, however the solution builds fine, and no error in the module file.
Any ideas on what I'm missing? I'm sure it's something stupid.
Thanks,
Justin
UPDATE
I tried mydogisbox's advice, which got rid of the error above, but now when I run the code in the .fsx file I get this error instead:
--> Referenced 'F:\Work\GitHub\qf-sharp\qf-sharp\bin\Debug\Microsoft.Accelerator.dll' (file may be locked by F# Interactive process)
[Loading F:\Work\GitHub\qf-sharp\qf-sharp\MonteCarloGPU.fs]
error FS0192: internal error: F:\Work\GitHub\qf-sharp\qf-sharp\Accelerator.dll: bad cli header, rva 0
UPDATE 2
So the bad header error has dissapeared, but now I get this instead:
Microsoft.ParallelArrays.AcceleratorException: Failure to create a DirectX 9 device.
at Microsoft.ParallelArrays.ParallelArrays.ThrowNativeAcceleratorException()
at Microsoft.ParallelArrays.DX9Target..ctor()
at <StartupCode$FSI_0002>.$FSI_0002_MonteCarloGPU.main#() in F:\Work\GitHub\qf- sharp\qf-sharp\MonteCarloGPU.fs:line 14
Stopped due to error
I found this thread on MSDN however the answers proposed as fixes on that thread barely even relate to the question.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/98600646-0345-4f62-a6c5-f03ac9c77179/ms-accelerator?forum=csharpgeneral
My Direct X version is 11, and I imagine that will suffice, however I tried installing DX9 however, it tells me that a newer version is detected therefore cant install.
There are special directives for referencing dlls from fsi. The #load directive loads the .fs file only. You need to use the #r directive to reference the file. You can either use the full path of the file or you can use #I to include the path to the file. More details here. Keep in mind that fsi is completely independent of your project, so all references in your project must be duplicated in fsi for it to access the same types.

Why am I recieving this error: LNK1104: cannot open file 'opencv_core246d.lib''?

I am trying to run a program that does not include any opencv files, but for some reason this error keeps popping up and preventing me from running the program.
LNK1104: cannot open file 'opencv_core246d.lib' C:\Users\Public\Documents\imgSwitchingFiles
Please can somebody shed light on this issue?
It looks like your project options state this library should be linked to your binaries. Did you reuse this project from elsewhere?
If you really don't need OpenCV, simply remove its libraries from the project linking options.
In project properties:
VC++ Directories>Library files>C:\OpenCV2.4.3\build\x86\vc9\lib
&
Linker>Input>Additional Dependencies>
Add the following under edit (each on a new line)
opencv_core243d.lib; opencv_imgproc243d.lib; opencv_highgui243d.lib; opencv_ml243d.lib; opencv_video243d.lib; opencv_features2d243d.lib; opencv_calib3d243d.lib; opencv_objdetect243d.lib; opencv_contrib243d.lib; opencv_legacy243d.lib; opencv_flann243d.lib;
Your file paths may be different i.e. vc10 instead of vc9 or u may have x64 instead of x86.
Also u will have 246 in every .lib instead of 243.

Resources