Cannot compile RtMidi VS community 2015 - c++

I am following the basic tutorial on https://www.music.mcgill.ca/~gary/rtmidi/ and I cannot seem to make it past the first step in "Getting Started."
Originally I was only getting two errors, one of which was a "LNK2019 - unresolved external symbol" error, which I fixed by linking rtmidi.lib and rtmidid.lib
Now I have a huge block of errors that I can't make any sense of
rtmidi.lib(RtMidi.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
RTMIDI_test.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RTMIDI_test.obj
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in RTMIDI_test.obj
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInUnprepareHeader#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInOpen#20
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutGetDevCapsW#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutPrepareHeader#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutOpen#20
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInReset#4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInPrepareHeader#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutUnprepareHeader#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInGetDevCapsW#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInStart#4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInClose#4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInAddBuffer#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInGetNumDevs#0
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutShortMsg#8
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutGetNumDevs#0
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutLongMsg#12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutClose#4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInStop#4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutReset#4
C:\Users\Zach\Desktop\RTMIDI_test\Debug\RTMIDI_test.exe : fatal error LNK1120: 19 unresolved externals
Obviously on lines 7-25 it's looking for a library or something that doesn't exist, but gives no hints as to what it is. The rest however, I can't even begin to figure out. Any Ideas?
I read somewhere else to change the project option to "Release" Which does get rid of the above messages, but instead replaces them with
RTMIDI_test.obj : error LNK2001: unresolved external symbol "public: __thiscall RtMidiIn::RtMidiIn(enum RtMidi::Api,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int)" (??0RtMidiIn##QAE#W4Api#RtMidi##V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##I#Z)
C:\Users\Zach\Desktop\RTMIDI_test\Release\RTMIDI_test.exe : fatal error LNK1120: 1 unresolved externals

Most of the link errors tell you what you need to do to fix them (at least in combination with a bit of googling)
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RTMIDI_test.obj
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in RTMIDI_test.obj
So RTMIDI_test.cpp has been compiled with a different value for _ITERATOR_DEBUG_LEVEL than in rtmidi.lib. The next line says that you are trying to link your debug project with a release build of rtmidi.lib. You should change this to link against the debug version instead which should remove some or all of the other warnings and errors.
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInUnprepareHeader#12
midiInUnprepareHeader and the other midiIn* functions live in winmm.lib (see the docs), so you also need to link against that.

Related

Issue with OpenCV 3.10 installation on Windows 7

I'm total begginer in Cmake and I don't know where I have to put code. My problem is:
CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
I'm following the instructions here https://www.learnopencv.com/install-opencv3-on-windows/
and found the answer here:
http://answers.opencv.org/question/165060/opencv-32-install-problems-in-windows10-64-bit-vs2017/
I need to add line in Cmake file but I don't know where to add it.
cmake -DENABLE_PRECOMPILED_HEADERS=OFF
If I add it here https://imgur.com/a/QdO7ucX it shows me error: CMake Error at
CMakeLists.txt:12:
Parse error. Expected a command name, got left paren with text "(".
this is my cmake file:
https://drive.google.com/open?id=1rhT_Sl2XH-ejI_tDBfSIbl2304huDq3n
Using Visual Studio 2013, OpenCV 3.10 Cmake 3.12
Can anyone help me?
edited:
1>------ Build started: Project: ConsoleApplication14, Configuration: Release x64 ------
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual double __cdecl cv::VideoCapture::get(int)const " (?get#VideoCapture#cv##UEBANH#Z)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl cv::VideoCapture::isOpened(void)const " (?isOpened#VideoCapture#cv##UEBA_NXZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl cv::VideoCapture::~VideoCapture(void)" (??1VideoCapture#cv##UEAA#XZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: __cdecl cv::VideoCapture::VideoCapture(int)" (??0VideoCapture#cv##QEAA#H#Z)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl cv::VideoWriter::write(class cv::Mat const &)" (?write#VideoWriter#cv##UEAAXAEBVMat#2##Z)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl cv::VideoWriter::~VideoWriter(void)" (??1VideoWriter#cv##UEAA#XZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: __cdecl cv::VideoWriter::VideoWriter(class cv::String const &,int,double,class cv::Size_<int>,bool)" (??0VideoWriter#cv##QEAA#AEBVString#1#HNV?$Size_#H#1#_N#Z)
1>c:\users\vartotojas\documents\visual studio 2013\Projects\ConsoleApplication14\x64\Release\ConsoleApplication14.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
errors with opencv_videoio300.lib:
1>------ Build started: Project: ConsoleApplication14, Configuration: Release x64 ------
1> Source.cpp
1>Source.cpp(15): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1>Source.cpp(16): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICOpen
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICClose
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICSendMessage
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICDecompress
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileInit
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileRelease
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileOpenA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileGetStream
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileCreateStreamA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamRelease
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamInfoA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamSetFormat
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamWrite
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamGetFrameOpen
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamGetFrame
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamGetFrameClose
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIMakeCompressedStream
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVISaveOptions
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol capCreateCaptureWindowA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol capGetDriverDescriptionA
1>c:\users\vartotojas\documents\visual studio 2013\Projects\ConsoleApplication14\x64\Release\ConsoleApplication14.exe : fatal error LNK1120: 20 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Adding /NODEFAULTLIB:library when building

Getting the following error when building:
1>------ Rebuild All started: Project: hw2_hci, Configuration: Release Win32 ------
1> Source.cpp
1>Source.cpp(373): warning C4551: function call missing argument list
1>Source.cpp(627): warning C4551: function call missing argument list
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__DescribePixelFormat#16
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__SetPixelFormat#12
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__SwapBuffers#4
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__CreateDCW#16
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__CreateDCW#16
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC#4
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC#4
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceCaps#8
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceGammaRamp#8
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__SetDeviceGammaRamp#8
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1120: 8 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Added the following, same error:
And this:
This problem occurs when I Use MFC in a Static Library. Why is this happening?
As someone suggested to go to this page, I added the following as suggested without it working.
And the error:
After adding gdi32.lib i got the following error:
1> Finished generating code
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z) already defined in LIBCMT.lib(typinfo.obj)
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's happening is that the default libraries specified by one or more objects (probably in a library you're using) is asking to be linked with an runtime library that isn't the same as what your project is using.
The docs on LNK4098 are reasonably clear about what's going on and how to troubleshoot the problem.
Don't add the libraries to ignore in the 'additional options', add them under Linker/Input/ Ignore specific default libraries' (I see you already have glfw3.lib there, just add libcmt.lib separated by a semicolon).

Miscrosoft VS C++ linking error when building for 64bit version

I am using Visual Studio 2005.
I am able to build 32bit without issue. But when I am building
64bit version, I am getting below linking error:
1>QALPROC.exp : error LNK2001: unresolved external symbol "const CustomMessageException::`vftable'" (??_7CustomMessageException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const DBException::`vftable'" (??_7DBException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const Exception::`vftable'" (??_7Exception##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const FileExportLoadException::`vftable'" (??_7FileExportLoadException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const PMemoryException::`vftable'" (??_7PMemoryException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const ReportsLoadingException::`vftable'" (??_7ReportsLoadingException##6B#)

Calling a c++ .exe from Matlab - Program Stopped Working?

I wrote a code in C++ called FaceTracker.cpp and other code in Matlab that do some analyzes and statics.
What I need to do is adding a button in matlab that calls the FaceTracker when being pressed. I tried to use the following command:
system (['FaceTracker.exe <' nameOfVideo]);
but it doesn't work. It opens the FaceTracker.exe GUI, then it stops ! (Like when internet explorer or any other program does sometimes\hang) with the msg "FaceTracker.exe stoped working.
When I tried to run the .exe from command prompt it showed me the following error:
Assertion Faile: Type == IO::TRACKER ... Debug error! R6010 - abort() has been called.
From what i understd from the answers\ other sites is that I need to statically link libraries.
I read in one site that I need to make the following changes:
The CRT:
• Configuration Properties -> C/C++ -> Code Generation: Where it reads Runtime Library, change to Multi-Threaded (/MT).
The manifest must go:
• Configuration Properties -> Manifest Tool -> Input and Output: Where it reads Embed Manifest, change to No.
But when I do it (Change to /MT) I start getting the following errors:
1> Generating Code... 1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>Tracker.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: void
__thiscall FACETRACKER::Tracker::Load(char const *)" (?Load#Tracker#FACETRACKER##QAEXPBD#Z) 1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol
__CrtDbgReportW 1>libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>IO.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>Patch.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>PAW.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>PDM.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>CLM.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FaceTracker.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FCheck.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FDet.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol
__free_dbg 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __free_dbg 1>Tracker.obj : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol
__free_dbg 1>IO.obj : error LNK2001: unresolved external symbol __free_dbg 1>Patch.obj : error LNK2001: unresolved external symbol __free_dbg 1>PAW.obj : error LNK2001: unresolved external symbol __free_dbg 1>PDM.obj : error LNK2001: unresolved external symbol __free_dbg 1>CLM.obj : error LNK2019: unresolved external symbol __free_dbg referenced in function "private: void __thiscall std::_Yarn<char>::_Tidy(void)" (?_Tidy#?$_Yarn#D#std##AAEXXZ) 1>FaceTracker.obj : error LNK2001: unresolved external symbol
__free_dbg 1>FCheck.obj : error LNK2001: unresolved external symbol __free_dbg 1>FDet.obj : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char
*,int)" (??2#YAPAXIABU_DebugHeapTag_t#std##PADH#Z) 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __malloc_dbg 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __malloc_dbg 1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype 1>C:\Users\wew\Documents\Jam3a\PROJECT-2012!!\FindSymetryInFaces\FaceTracker\Debug\FaceTracker.exe : fatal error LNK1120: 4 unresolved externals
Any Suggestions?
What do I Have to do in order to be able to use the FaceTracker.exe in every computer, also the ones that doesn't have c++\vs compiler?
besides, why does my program OPENS when I call it from matlab but then Hangs\stops working?
Thank in advance.
This almost certainly has nothing to do with debug versus release or whether mt is enabled. You are not making a matlab extension, just using a binary from the command line. If the program works when you type things in from the command line, it should work when called from Matlab unless you are running low on memory (highly unlikely also).
I would examine the contents of . .
['FaceTracker.exe < ' InputVid]
...and copy and paste the string directly into the command line (system, not Matlab) to see if you can replicate the error. The error is most likely occurring because your exe is not handling the file string well.
Try putting the inputvid, calling m file, and FaceTracker.exe in the working directory to make the most simple scenario. If that works, make things more complex by placing input vid into another directory and bug hunt from there.
Best of luck!
I think this exe file depends on some other libraries. You should copy them into one of the directories in your system parameter PATH. Or you can use the static link option when build your project.
Your applications don't require the entire Visual C++ compiler to be installed, just the runtime library. Microsoft has a free redistributable which can add this runtime library to any computer. You can find vcredist_x86.exe in your Visual C++ install path, or download it from http://www.microsoft.com/en-us/download/details.aspx?id=8328

Error in Release mode but not in Build mode

I recently made a project using opencv and c++ in visual 2008
When i build the project in Debug mode - i don't face any issues - but when i build it in release mode i get the following errors:
1>test.obj : error LNK2001: unresolved external symbol _cvHaarDetectObjects
1>test.obj : error LNK2001: unresolved external symbol _cvCvtColor
1>test.obj : error LNK2001: unresolved external symbol _cvCreateImage
1>test.obj : error LNK2001: unresolved external symbol _cvDestroyWindow
1>test.obj : error LNK2001: unresolved external symbol _cvWaitKey
1>test.obj : error LNK2001: unresolved external symbol _cvGetSize
1>test.obj : error LNK2001: unresolved external symbol _cvReleaseCapture
1>test.obj : error LNK2001: unresolved external symbol _cvCreateMemStorage
1>test.obj : error LNK2001: unresolved external symbol _cvClone
1>test.obj : error LNK2001: unresolved external symbol _cvNamedWindow
1>test.obj : error LNK2001: unresolved external symbol _cvQueryFrame
1>test.obj : error LNK2001: unresolved external symbol _cvLoad
1>test.obj : error LNK2001: unresolved external symbol _cvRectangle
1>test.obj : error LNK2001: unresolved external symbol _cvCreateCameraCapture
1>test.obj : error LNK2001: unresolved external symbol _cvGetSeqElem
1>test.obj : error LNK2001: unresolved external symbol _cvShowImage
Check Linker->Input->Additional Dependencies settings in the Release configuration ; you have undoubtedly forgotten to include the OpenCV libraries. Just copy-paste them from the Debug configuration, but don't forget to remove the d suffix.
E.g. cv210.lib : Release mode and cv210d.lib : Debug mode.
You are not including the same libraries in your release build that you include in your debug build. "unresolved external symbol" means it cannot find the implementation for a function you are referencing.
This happens when you give Additional Dependencies to Debug mode but not in Release.