05-31-2017 05:34 AM
For reasons too long to explain here, I often link a static library compiled with debug option to my main programs.
If I forget to switch to release mode library and I build the release configuration occurs a single linker error:
error: Undefined symbol '___CompiledDebuggingLevel' referenced in "c:\program files (x86)\national instruments\cvi2017\bin\msvc\cvistart.lib".
As far as I can understand, the debug mode library expects that someone defines the variable.
This issue should have be corrected in 2012 (CAR 372694) but it still occurs in LabWindows/CVI 2017.
With a simple additional source file, I have resolved the issue so I can safely forget 🙂 to manually switch the static library. If you have the same issue, cut & paste in a .c file and add it to your program sources.
// // DebugLevelPatch.c // // A patch to really fix issue 372694 // // By including this file in a LabWindows CVI project, you can avoid link errors // that may occurr when you link a "release" executable with a static library that was // built with "debug" options. // // The value of this variable is related to the "Debugging Level" setting in Build Options dialog box. // We can know its values by printing it from a normal debug executable: // No run-time checking = 1 // Standard = 2 // Extended = 3 // so the natural choice for a release mode executable is 1. // // If this could be included in "release mode" C startup code, it would fix the problem // in a more elegant way. // #ifdef NDEBUG int __CompiledDebuggingLevel = 1; #endif
06-01-2017 04:05 AM
Hi carlox,
thanks for your post! I'll go ahead and signal this to make sure it gets fixed, but in the mean time this is a great workaround.
Best,
CorraDIT