LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Link error after including a static library

Hello

 

In order to debug a library, I built the library files with a main module and a uir as debug executable. Now that I have debugged, I went to build my original executable (after building the static library) and get the following errors.

 

Help!

 

4 Project link errors
 Undefined symbol '___CompiledDebuggingLevel' referenced in "c:\program files (x86)\national instruments\cvi2012\bin\msvc\cvistart.lib".
 Undefined symbol '___PtrInfoFixupTable' referenced in "c:\program files (x86)\national instruments\cvi2012\bin\msvc\cvistart.lib".
 Undefined symbol '___CVI_Sections' referenced in "c:\program files (x86)\national instruments\cvi2012\bin\msvc\cvistart.lib".
 Undefined symbol '___UFRNameTable' referenced in "c:\program files (x86)\national instruments\cvi2012\bin\msvc\cvistart.lib".

0 Kudos
Message 1 of 19
(5,939 Views)

I am posting an update to this. I changed the "Enable .obj" option for all the files in the project as well as the library files. Rebuilt the library and now the project build the release executable without the lnk errors. Is that the correct way to solve this problem?

0 Kudos
Message 2 of 19
(5,933 Views)

If that fixes it, it would seem that those particular files were .obj files. In which case this seems like a perfectly reasonable way of resolving the issue.

 

It seems strange that this isn't the default setting.

 

Thanks,

Joel G
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 3 of 19
(5,909 Views)

Hi CPP,

 

Are you using CVI 2012? If so, then you likely ran into known issue 372694. This is a bug with the build configuration for the static library introduced in CVI 2012. The problem occurs when you switch the Target Type from a Dynamic Link Library or Executable that was in a debug configuration to Static Library. Static Libraries are not allowed to be built in a debug configuration, so CVI tries to switch from the debug configuration to release when the target type is changed to Static Library. In CVI 2012, this change from debug to release does not fully occur, so you are left in an inconsistent configuration state. In this state, the static library is built with debug symbols that it does not define.

 

The good news is that it is very easy to fix. After switching the Target Type to Static Library, simply reselect Release as the configuration (the Release option will already be selected, but go ahead and select it again anyway). Once you reselect that, the Static Library will be built correctly without the debug symbols.

 

Using the Enable .Obj Option should not be necessary, and will not allow you to debug your application.

 

Edit: This issue will be addressed in the next release of CVI.

National Instruments
0 Kudos
Message 4 of 19
(5,877 Views)

Hello every body, 

 

Ten years later... I'm using CVI2017 and I'm trying to compile an EXE project with 2 project static DLL. 

On debug mode it's ok, but on release I got the same debug level error. 

I tried all tricks in this topic but I got always the same error.

 

Can someone advice please ? 

 

 

0 Kudos
Message 5 of 19
(2,763 Views)

Hello,

A DLL is not static. A .lib is.

What's the error ?

Is the .dll file in the right place (project directory or C:\Windows\Sys... something) ?

If you've upgraded CVI, have you regenerated the import library ?

0 Kudos
Message 6 of 19
(2,758 Views)

Yes, I'm using .LIB not DLL. 

 

The error is :  "Undefined symbol '___CompiledDebuggingLevel' referenced in "c:\program files (x86)\national instruments\cvi2017\bin\msvc\cvistart.lib"

 

Is the .dll file in the right place (project directory or C:\Windows\Sys... something) ? >> .LIB files are in the project folder, under a subfolder. The path is added to the project. 

 

If you've upgraded CVI, have you regenerated the import library ? >> All .LIB are compiled in the same workspace under CVI2017 with no issue (static). 

 

0 Kudos
Message 7 of 19
(2,753 Views)

Thank you very much for the answer understood a bit more

 

บาคาร่า

0 Kudos
Message 8 of 19
(2,750 Views)

OK, so it's not a DLL, just problems linking correctly with a .LIB that you compile yourself separately (with CVI I assume ?).

 

So 2 projects ? One with [Build][Target Type] set as static lib and without a main(). The other set as executable and with a main() and with a call to InitCVIRTE() ?

 

Correct ?

0 Kudos
Message 9 of 19
(2,746 Views)

Infact I have 3 projects all under CVI2017 : 

- 2 projects compiled as static library (release mode OK)

- 1 project with "InitCVIRTE" and I'm trying to compile it in the release mode to get the EXE file. (in debug mode I can compile without issues) 

0 Kudos
Message 10 of 19
(2,740 Views)