Search code examples
cvisual-studio-2010lnk2001

Including Agilent Drivers in Ansi-C VS2010 Project results in error LNK2001


I am unable to resolve a linker error

my projects includes in one of its c files:

#include "../bin/AgN6700/agN6700.h"
#pragma comment(lib, "bin/AgN6700/agN6700.lib")

This is a adaption to a powersupply. This adaption has several dependencies.

76 symbols fail to link. 8 are defined in the ivi.h 76 are defined in the visa.h

dependencies-and-errors

I have lib files for both of them on my machine in the folder:

C:\Program Files (x86)\National Instruments\Shared\CVI\ExtLib\msvc

So i added this folder to the library entrie in the VS2010 Project.

VS2010-Folder

What is going wrong here? How can i investigate and solve this issue?

The full list of LNK2001 errors:

agN6700.lib(agn6700.c) : error LNK2001: ... Symbol "...".

_viOpen@20
_viClose@4
_viSetAttribute@12
_viRead@16
_viSetBuf@12
_viPrintf
_viScanf
_viQueryf
_Ivi_DefaultCheckCallbackViInt32@16
_Ivi_DefaultCheckCallbackViReal64@20
_Ivi_SpecificDriverNew@12
_Ivi_Dispose@4
_Ivi_SetAttributeViInt32@20
_Ivi_SetAttributeViReal64@24
_Ivi_SetAttributeViString@20
_Ivi_SetAttributeViBoolean@20
_Ivi_SetAttributeViSession@20
_Ivi_SetAttributeViAddr@20
_Ivi_CheckAttributeViInt32@20
_Ivi_CheckAttributeViReal64@24
_Ivi_CheckAttributeViString@20
_Ivi_CheckAttributeViBoolean@20
_Ivi_CheckAttributeViSession@20
_Ivi_GetAttributeViInt32@20
_Ivi_GetAttributeViReal64@20
_Ivi_GetAttributeViString@24
_Ivi_GetAttributeViBoolean@20
_Ivi_GetAttributeViSession@20
_Ivi_GetAttributeViAddr@20
_Ivi_AddAttributeViInt32@32
_Ivi_AddAttributeViReal64@40
_Ivi_AddAttributeViString@28
_Ivi_AddAttributeViBoolean@28
_Ivi_AddAttributeViAddr@28
_Ivi_SetAttrReadCallbackViString@12
_Ivi_SetAttrCheckCallbackViInt32@12
_Ivi_SetAttrCheckCallbackViReal64@12
_Ivi_SetAttrCheckCallbackViBoolean@12
_Ivi_SetAttrCoerceCallbackViReal64@12
_Ivi_InvalidateAttribute@12
_Ivi_InvalidateAllAttributes@4
_Ivi_NeedToCheckStatus@4
_Ivi_SetNeedToCheckStatus@8
_Ivi_BuildChannelTable@16
_Ivi_CoerceChannelName@12
_Ivi_GetNthChannelString@12
_Ivi_SetErrorInfo@20
_Ivi_GetErrorInfo@16
_Ivi_ClearErrorInfo@4
_Ivi_ParamPositionError@4
_Ivi_LockSession@8
_Ivi_UnlockSession@8
_Ivi_IOSession@4
_Ivi_RangeChecking@4
_Ivi_QueryInstrStatus@4
_Ivi_Simulating@4
_Ivi_GetStringFromTable@12
_Ivi_GetValueFromTable@12
_Ivi_GetAttrRangeTable@16
_Ivi_GetViInt32EntryFromValue@32
_Ivi_GetViInt32EntryFromString@28
_Ivi_Alloc@12
_Ivi_Free@8
_Ivi_SetValInStringCallback@12
_Ivi_GetSpecificDriverStatusDesc@16
_Ivi_CompareWithPrecision@24
_Ivi_WriteInstrData@8
_Ivi_ReadInstrData@16
_Ivi_GetInfoFromResourceName@20
_Ivi_GetNextCoercionString@12
_Ivi_GetNextInterchangeCheckString@12
_Ivi_ResetInterchangeCheck@4
_Ivi_ClearInterchangeWarnings@4
_Ivi_GetAttributeFlags@12
_Ivi_SetAttributeFlags@12
_Ivi_ApplyDefaultSetup@4

Solution

  • It seems i misunderstood how lib files are included in the buildprocess.

    The solution is to supply the linker with additional dependencies via the project properties.

    This is illustrated in this stackoverflow post.