LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Linker error Multiple definitions for symbol

Solved!
Go to solution

Hi,

I have ported a project from Linux-based DAQmx to LabWindows CVI 2012 on a PXI machine. After making all conversion requirements, and successfully compiling, I am getting tons of the following linker errors for various modules files (just pasting

a subset of those here):

 

Multiple definitions for symbol '_PtrToPtr64' in modules X and Y

Multiple definitions for symbol '_Ptr64ToPtr' in modules Z and Y

Multiple definitions for symbol '_HandleToHandle64' in modules X and Y

Multiple definitions for symbol '_HEAP_MAKE_TAG_FLAGS' in modules X and Y

Multiple definitions for symbol '_TpInitializeCallbackEnviron' in modules X and Y

.....

 

I found this relevant post: http://forums.ni.com/t5/LabWindows-CVI/CVI2010-clang-link-errors-with-Windows-SDK/td-p/1425690

which points to a known issue in CVI 2010. However the workaround (enabling C99 build option) is already set in my project, so this solution does not apply.

 

Any idea what could be causing these windows.h symbols to get redefined?

 

Thank you

 

0 Kudos
Message 1 of 6
(5,182 Views)

Can you run other examples that are accessing the Windows SDK without linker errors?

 

You can also try adding import libraries for functions that are not automatically linked as suggested in this KnowledeBase article.

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 2 of 6
(5,157 Views)

@Anjelica-W wrote:

Can you run other examples that are accessing the Windows SDK without linker errors?

 

You can also try adding import libraries for functions that are not automatically linked as suggested in this KnowledeBase article.



Thanks for your reply. Yes I can run some basic apps that use windows.h without these linker errors, but cannot figure out the difference with mine. One more thing that could help diagnose the issue: Some of these fuctions are defined in file basetsd.h

located in CVI2012\sdk\include, an excerpt of that code is below, which seems to be added by CVI. Is it possible that these are also defined somewhere else, causing the conflict? How can I see the linker options in CVI and find the path that it searches for libraries to link?

 

// ADDED TO BY CVI
#if !(defined (_CVI_) && defined (_INTERACTIVE_WINDOW_BUILD_))
__inline
void * POINTER_64
PtrToPtr64(
const void *p
)
{
return((void * POINTER_64) (unsigned __int64) (ULONG_PTR)p );
}

__inline
void *
Ptr64ToPtr(
const void * POINTER_64 p
)
{
return((void *) (ULONG_PTR) (unsigned __int64) p);
}

__inline
void * POINTER_64
HandleToHandle64(
const void *h
)
{
return((void * POINTER_64)(__int64)(LONG_PTR)h );
}

__inline
void *
Handle64ToHandle(
const void * POINTER_64 h
)
{
return((void *) (ULONG_PTR) (unsigned __int64) h );
}
#endif /* _CVI_ */

 

 

0 Kudos
Message 3 of 6
(5,141 Views)
Solution
Accepted by mjr1357

Some of the Windows SDK functions ,may have the same name as the LabWIndows/CVI functions. Is your Windows.h file before all of the other header files? Please see the following article for more information: http://digital.ni.com/public.nsf/websearch/69C82671913CAA4986256E9400676E17?OpenDocument

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 4 of 6
(5,105 Views)

Thank you, moving windows.h up in the inculdes helped resolve this issue.

0 Kudos
Message 5 of 6
(5,090 Views)

No Problem. Glad I could help!

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 6 of 6
(5,082 Views)