_initp_misc_cfltcvt_tab and _FPinit when switching to /MDd - c++

I switched my Visual C++ 2012 project from Multi-threaded Debug (/MTd) to Multi-threaded Debug DLL (/MDd). The project is a mixture of C++ .vcxproj and Intel Fortran (.vfproj) projects. After all is rebuild I get the errors below.
In CRT source code I see the offending symbols are defined in crt0dat.c if CRTDLL symbol is not defined. How do I make sure I get crt0dat with CRTDLL when compiling main application?
Any other suggestions how do I troubleshoot this?
50>cmain.obj : error LNK2019: unresolved external symbol _initp_misc_cfltcvt_tab referenced in function wWinMain
50>cmain.obj : error LNK2001: unresolved external symbol _FPinit
50>C:\spm\git\clones\SPM80_dll\MSBuild\x64\dll_debug\SPM_dll_debug_x64.exe : fatal error LNK1120: 2 unresolved externals

I believe /MDd builds require msvcrtd.lib. This should be something that automatically gets linked into your project; it might be that it's ignored through a project setting. Open the Project Settings for the C++ project and look under Linker->Input. There are settings there for Ignore All Default Libraries and Ignore Specific Default Libraries. See if there's anything there that might cause the linker to ignore msvcrtd.lib.
BTW, your code will also need the appropriate DLL to run, which for VS 2012 would be msvcr110d.dll. This should already installed on your machine when you installed VS 2012, but it will have to be distributed with the executable if you move it to another computer.

Related

CVI Project to Visual Studio Project

I'm trying to move a project from LabWindows/CVI 9 to Visual studio, I've been correcting errors by importing cvi libraries, now I've run into this error, but I can't find where the library comes from and it seems to be the last one I'm missing
LNK2019 unresolved external symbol _main referenced in function _WinMain#16 MES_Control_2.0.3.39 cviwmain.lib(extwmain.obj)
in the case of the other libraries it gave the same error but now I can't find extwmain.c or extwmain.lib
Your project already is configured to link cviwmain.lib. The error means it needs a main() function. You probably configured your project as a windows application(not a console application), so just remove that library because you don't need it. See this documentation for detail.

Can I use blowfish without the whole OpenSSL library?

I am trying to compile networking dll project in Visual Studio 2010. In past, the original authors used the project to produce standalone dll file that could be distributed with the server it was used for. If I open their dll, I cans see this in dependency walker (the red items are not really an issue, the dll works):
Now I tried to compile the project, but for both 32bit and 64bit (and 64bit is what I'm supposed to get to work) I produce a library that requires OpenSSL installed:
Trying to put the libeay32.lib out of the build just causes link errors:
1> Finished searching libraries
1>TTClient.obj : error LNK2001: unresolved external symbol _BF_set_key
1>TTProtocol.obj : error LNK2001: unresolved external symbol _BF_ecb_encrypt
1>D:\techsys\WebSightR220lib\Release\WebSightR220lib.dll : fatal error LNK1120: 2 unresolved externals
Turns out linking seemingly huge static library is not as big problem when you want to use just a fraction of OpenSSH. The compiler will not just copy the library in your binary, it will just pick the parts that are needed.

Visual Studio 15 __imp___iob, __imp___pctype, __imp___mb_cur_max

I am trying to use a library compiled with mingw in visual studio. However, I get the following linker errors:
error LNK2001: unresolved external symbol __imp___iob
error LNK2019: unresolved external symbol __imp___pctype referenced in function
error LNK2019: unresolved external symbol __imp____mb_cur_max referenced in function
error LNK2001: unresolved external symbol _fprintf
I was able to fix the _fprintf error by linking against legacy_stdio_definitions.lib as per this post : unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2.
However, I have no idea how to fix the other three unresolved externals. How can I fix this? The libraries work perfectly under Visual Studio 2013.
Edit:
Okay here is an update. I moved libmsvcrt.a from the mingw lib folder into Visual Studio, and I added that to the linker settings. Now it seems to work correctly.
The libraries were compiled against an old version of the CRT. The unresolved symbols you get are internal symbols of the CRT that are present in the compiled library. You have to recompile the library against the VS2015 CRT (the Universal CRT). But I'm not sure if MinGW supports this.
If you can't do that, you have to continue to use the VS2013 compiler. (You can use the VS2015 IDE, by setting the toolset to vs2013 in the project options. But you'll still be limited to the C++ features the 2013 compiler supports.)
I encountered the same problem (library compiled with static CRT instead of CRT in DLL) and I managed to make it work by changing the two following parameters in Project Properties:
Linker > Input > Ignore specific default libraries: libc.lib
C/C++ > Code Generation > Runtime Library: Multi-threaded Debug (/MTd)
If that's not enough, there's more at following page: https://social.msdn.microsoft.com/Forums/en-US/841e5723-bce4-4340-b7b3-027dcdf90f00/

Kinect + Visual Studio 2013 LNK errors, how to properly link the library?

I downloaded kinect sdk both 1.8, and 2.0. I then created a new project, and edited its properties via C/C++ and included x86 headers folders
I also edited its Linker and added its corresponding x86 libraries folder.
Yet I still get linking errors, and it's not clear to me what it may be.
error LNK2019: unresolved external symbol __imp__NuiInitialize#4 referenced in function _wmain
error LNK1120: 1 unresolved externals
Any idea? Not sure what else I can do in the linker settings.
Problem resolved,
In addition to
C/C++ include
Linker library
You also need to edit
Linker Input
In here you add Kinect10.lib (or Kinect20.lib, depending on what version you're using)

Compiling C++ program using MS Visual Studio 2010 as to not depend on any external code or redistributables

I want my exe to be runnable without depending on any redistributable packages but when I set
"Use of MFC" to "Use MFC in a Static Library" in the Project > Properties menu, I get errors such as this one:
- Error 2 error LNK2019: unresolved external symbol _imp_GetWindowTextW#12 referenced in function _wmain
So basically I get unresolved external symbol for the functions.
Thank you.
In Project->Properties->Linker->Command Line type user32.lib
Under the linker settings for your project, make sure you've included the default libraries under "Additional Dependencies".
This is usually:
kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
Also, make sure have not set "Ignore All Default Libraries".