02-06-2014 03:29 PM
Moving from 32-bit XP to Windows 7 using Microsoft Visual Studio 2008 C++. When linking with NI-488.2 version 3.0.2 I (ni4882.obj) get the following warning and errors:
1>Linking...
1>ni4882.obj : warning LNK4217: locally defined symbol _time64 imported in function time
1>ni4882.obj : error LNK2019: unresolved external symbol __imp_rand referenced in function LoadFunction
1>ni4882.obj : error LNK2019: unresolved external symbol __imp_srand referenced in function LoadFunction
1>ATP.exe : fatal error LNK1120: 2 unresolved externals
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 9.00.21022
1>Copyright (C) Microsoft Corporation. All rights reserved.
Any ideas.
Solved! Go to Solution.
02-07-2014 08:53 AM
Hi ndg12,
I recommend you to take a look to these MSDN pages to solve these errors and that warning:
- http://msdn.microsoft.com/en-us/library/aa3se25k.aspx
- http://msdn.microsoft.com/en-us/library/799kze2z.aspx
Regards,
Carmen C
02-07-2014 10:29 AM
02-10-2014 09:53 AM
Got an error when attempting to navigate to the ReadMe page. Aren't these errors being generated from within the National Instruments "ni4882.obj" file? Was it generated with a later version of Microsoft Visual than my 2008 version? I don't have source code for that object file.
02-12-2014 11:31 AM
Apparently this problem can be alleviated by using dynamic link libraries rather than static link libraries. I would certainly prefer static libraries since my application will be distributed widely. Don't know who to blame. It could be a NI or a Microsoft problem.
02-13-2014 08:49 AM - edited 02-13-2014 08:52 AM
There are 2 ways of linking libs with MSVC and more generally IDE's (sorry if repetitive) :
• .dll => linked by environment path => dynamic
• .lib => linked in your IDE and/or makefile => static
I personnaly never use .obj, but I'd bet you should avoid using it and prefer .lib.
02-24-2015 05:34 PM
Hi Guys,
I got this error too recently. Was troubling me a lot. I was using Windows 7 OS, Visual Studio 2010 compiler.
The fix for this is pretty much straight forward and solution lies in the Project settings only.
To my knowledge, with /MDd switch, it causes the compiler to place the library name MSVCRTD.lib into the .obj file.
But with /MTd switch, This option just causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols. For details, please refer to this MSDN article:
https://msdn.microsoft.com/en-us/library/2kzt1wy3(VS.71).aspx
Its very useful.
Also
MDd stands for Multi-threaded Debug DLL
MTd stands for Multi-threaded Debug
Thanks,
Kiran
01-05-2018 08:13 AM - edited 01-05-2018 08:16 AM
What was "the fix" in project settings that was straightforward? I have been struggling with this issue for a while now and the page linked does not exist anymore. Is it possible to use static linking with NI488.2 libraries or was "the fix" to use dynamic linking? Because my application requires static linking.
01-08-2018 09:21 AM
Since this is an old post, I would reccommend creating a new post and link to this one for increased visibility.
However, I was able to find the broken link from above using the Wayback Machine.
Hopefully that will help you with your problem.
01-08-2018 09:36 AM - edited 01-08-2018 10:00 AM
Thanks, I will try a new thread.
edit: new thread is here: https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/NI-488-2-static-linking/td-p/3738956