Error LNK 2038 while connecting to mysql using cpp - c++

while connecting database in cpp I get this error
1>------ Build started: Project: conn, Configuration: Release Win32
1> test.cpp
1>LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
1>mysqlcppconn-static.lib(mysql_driver.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1700' in test.obj
1>mysqlcppconn-static.lib(mysql_driver.obj) : error LNK2038: mismatch
1>mysqlcppconn-static.lib(dtoa.obj) : error LNK2001: unresolved external symbol __dtoui3
1>mysqlcppconn-static.lib(timer.obj) : error LNK2001: unresolved external symbol __dtoui3
1>mysqlcppconn-static.lib(dh.obj) : error LNK2001: unresolved external symbol __dtoui3
1>mysqlcppconn-static.lib(libmysql.obj) : error LNK2001: unresolved external symbol __ftol3
1>mysqlcppconn-static.lib(libmysql.obj) : error LNK2001: unresolved external symbol __ftoul3
1>c:\users\pcw\documents\visual studio 2012\Projects\conn\Release\conn.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I Added dependencies as given on mysql official page but I get this error. I searched
over internet but not found such solution...
I am new to cpp.

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 ==========

OpenSSL Compile WinCE 6.0

I am trying to compile OpenSSL 0.9.8i with windows CE SDK Toradex CE600 with reference to steps defined in the link below
OpenSSL Compile WinCE
When running nmake -f ms\cedll.mak command getting many Link2001 Errors as below
Please Help me in resolving this errors.
OLDNAMES.lib(wcsdup.obj) : error LNK2001: unresolved external symbol _wcsdup
OLDNAMES.lib(strnicmp.obj) : error LNK2001: unresolved external symbol __strnicmp
OLDNAMES.lib(stricmp.obj) : error LNK2001: unresolved external symbol __stricmp
OLDNAMES.lib(setmode.obj) : error LNK2001: unresolved external symbol __setmode
OLDNAMES.lib(fileno.obj) : error LNK2001: unresolved external symbol __fileno
OLDNAMES.lib(strdup.obj) : error LNK2001: unresolved external symbol __strdup
OLDNAMES.lib(wcsdup.obj) : error LNK2001: unresolved external symbol __wcsdup
out32dll_ARMV4I\libeay32d.dll : fatal error LNK1120: 113 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ce\bin\x86_arm\link.EXE"' : return code '0x460'
Stop.
If you need to add SSL/TLS support to your application and don't have specific dependencies on openSSL, you may have a look at mbedTLS:
https://github.com/ARMmbed/mbedtls
I made a fork of an old version to build it for Windows Embedded Compact 2013:
https://github.com/VMinute/mbedtls
and it builds with almost no changes.

Cannot compile RtMidi VS community 2015

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.

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).

GLFW - Failed To Open A Window

As my hunt for a cross-platform framework/library went in progress, GLFW was mentioned many times. So, I decided to try it out. Now, it seems as though I can't even init a window. :-/
#include
#include
#include
int main(int argc, char *argv[])
{
int running = GL_TRUE;
srand(time(NULL));
if (!glfwInit())
exit(EXIT_FAILURE);
if (!glfwOpenWindow(300, 300, 0, 0, 0, 0, 0, 0, GLFW_WINDOW))
{
glfwTerminate();
exit(EXIT_FAILURE);
}
while (running)
{
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(rand() % 255 + 1, rand() % 255 + 1, rand() % 255 + 1, 0);
glfwSwapBuffers();
running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
}
glfwTerminate();
exit(EXIT_SUCCESS);
}
I typed this in MVC++ 2010, linked the header, and 2 lib files (and it had 1 DLL file, so I threw that into the SysWOW64 folder), and I get these errors:
1>------ Build started: Project: glfwTest, Configuration: Debug Win32 ------
1> test.cpp
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(8): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(22): warning C4244: 'argument' : conversion from 'int' to 'GLclampf', possible loss of data
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(22): warning C4244: 'argument' : conversion from 'int' to 'GLclampf', possible loss of data
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(22): warning C4244: 'argument' : conversion from 'int' to 'GLclampf', possible loss of data
1>test.obj : error LNK2019: unresolved external symbol __imp__glClearColor#16 referenced in function _main
1>GLFW.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp__glClearColor#16
1>test.obj : error LNK2019: unresolved external symbol __imp__glClear#4 referenced in function _main
1>GLFW.lib(window.obj) : error LNK2001: unresolved external symbol __imp__glClear#4
1>GLFW.lib(win32_window.obj) : error LNK2001: unresolved external symbol __imp__glClear#4
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol __imp__wglGetProcAddress#4 referenced in function _initWGLExtensions
1>GLFW.lib(win32_glext.obj) : error LNK2001: unresolved external symbol __imp__wglGetProcAddress#4
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol __imp__wglMakeCurrent#8 referenced in function _createWindow
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol __imp__wglCreateContext#4 referenced in function _createContext
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol __imp__wglDeleteContext#4 referenced in function _destroyWindow
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol __imp__glGetFloatv#8 referenced in function __glfwPlatformSetWindowSize
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol __imp__glGetIntegerv#8 referenced in function __glfwPlatformSetWindowSize
1>GLFW.lib(glext.obj) : error LNK2001: unresolved external symbol __imp__glGetIntegerv#8
1>GLFW.lib(glext.obj) : error LNK2019: unresolved external symbol __imp__glGetString#4 referenced in function __glfwParseGLVersion
1>c:\users\andrew\documents\visual studio 2010\Projects\glfwTest\Debug\glfwTest.exe : fatal error LNK1120: 9 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I understand the first few with the random colors, but the ones after that make no sense to me. Any idea what's wrong with this?
I'm pretty sure that I have linked the libs correctly. I place them into the
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib directory
and even linked them to my
C:\SDK\GLFW\glfw-2.7.bin.WIN32\lib-msvc100\debug directory.
The GLFW package was a .zip file, so I just extracted it to my default SDK folder (for all my APIs and other stuff). So the C:\SDK\GLFW is my default for GLFW.
You need to link to opengl32.lib.
For that, as pictured below, go to Project Setting and then Linker > input > Additional Dependencies and add opengl32.lib there (use ; to separate different libs).
Note that you don't actually need to have opengl32.lib file anywhere. Visual Studio knows where to find it.
Edit: I should note that you don't need to do anything except adding opengl32.lib. That other stuff is irrelevant. Additionally, if both are present, try swapping the order, which matters in some cases.