Clang, CVI, C99

Hi all

no doubt, a hint of avoid a trap that I fell...

If you use the C99 features, be aware that definitions such as INFINITY or NAN will be unavailable for an external compiler such as clang.

This is because these definitions (in math.h) are preceded by

#if _CVI_C99_EXTENSIONS_

For an external compiler, this condition is FALSE; so go to an external compiler, you will get errors due to identifiers undeclared.

This, of course, can be avoided by adding

#ifndef NAN
#define NAN 0xCp125f
...

#endif

for an include file.

A nicer solution would be an up-to-date the clause in the math.h file, or in the definition of _CVI_C99_EXTENSIONS_ for the compilers external, but it would be at OR...

Dear Luis,

a better solution is always welcome

I tried your suggestion, but somehow, it didn't work:

what I did: I added your text in the field Flags of C99, so now field bed - std = c99 /D_CVI_C99_EXTENSIONS_

However, the compilation gives an error: error reading "/ D_CVI_C99_EXTENSIONS_"

After investigating the matter, the correct solution and therefore even better seems to be to edit the field as follows:

C99 flags :--std = c99 _CVI_C99_EXTENSIONS_ d

(in other words, you have missed a space after the D and confused the slash with the sign less)

This way I can skip my page header and the compilation seems to succeed.

As you have already mentioned, it would be nice if ecc files could be updated accordingly

Tags: NI Software

Similar Questions

  • Crash of CVI 2013 with the debug version

    Hello

    I'm trying to migrate a large enough project of CVI 2012SP1-CVI 2013 and feels the clang compiler crash when I try a debug on some files.  Clang will also plant (' Labwindows/CVI the Clang compiler has stopped working... ") so I am just trying to compile the file (ctrl-k) in the editor.  Here's what I found:

    • A release not crushed

    • By turning the C99 power button has no effect

    • Change the warning level has no effect (other than the types of warnings that I get, of course)

    • Change the ' debug ' on 'No run-time check' eliminates the crash.

    • 'Enable. Option of obj"eliminates the crash.

    • By turning precompiled headers power has the effect.

    Here is the long message I get from the compiler when this happens (including all the warnings that are always displayed when the level is set to 'None'):

    Any thoughts?  Unfortunately it's a pretty big project that I can't post and it doesn't seem to be an indication of the or the lines in the file that he has problems with it, so I can't limit, although it seems to hint that he has problems with the structures of some sort.  The PC is running Windows 7 Pro 32 bit if it matters.

    Thank you.

    Hi tstanley,

    We could find the cause of the accident of the compiler from your code. We will settle in the next update and you can follow with bug ID 422577.

    The issue occurs when in a function, you have a call to a function that returns a structure in a global variable and then refer to this world in another function. For example:

    struct Foo foo; global variable foo

    Sub FuncA()
    {
    foo = GetStructFoo();
    }

    Sub FuncB()
    {
    do something with foo / / crash
    }

    In this case is because we are bad associate information of temporary pointer with foo in FuncA. Then in FuncB, clang will crash when it tries to access this pointer information.

    There are two workaround solutions, but both require changes in the code.

    1. modify the function that returns the structure, GetStructFoo in my example, the return via a pointer parameter:

    void GetStructFoo(Foo *foo);

    2 use a temporary local variable to manipulate the structure returned and then assign its value to the overall structure:

    struct Foo tempFoo;

    tempFoo = GetStructFoo();

    foo = tempFoo;

    In our next update, we will include the fix for this bug.

  • LabWindows/CVI cannot compile a simple code

    Hi all!

    It's looks funny but LabWindows/CVI-9.1.0(427) cannot compile a simple C code

    XML.h

    void f();

    XML.c

    #include 'xml.h.

    typedef struct
    {
    int bar;

    } foo;

    void f()
    {
    int Baz = 0;
    If (!) Baz) baz = 1;
    foop foo;
    return;
    }

    It's not a bug, you make a statement block to a variable foop which is not allowed in the standard ANSI C89.

    You can activate the C99 extensions with a pragma if you want this to work in CVI 9.1

    Menchar

  • CVI 8 has problems with the code of CVI 2009 - why?

    I use NI CVI 2009 and thus programmed. Now, I bought 8 CVI and wants to continue programming. But CVI reports errors in the source code of the ICB 9 and I do not understand what is the problem?

    example of

    char save [size + 1];

    Erros

    128, integer 22 should be constant.
    ...

    What is the problem with this simple line of code that worked perfectly before?

    Unfortunately the statements of variable length arrays is a feature of c99 is supported in CVI9, but probably not in version 8. If you use CVI8.5, you can try to add this pragma at the code and see if that fixes the problem, but according to this list of features posted by Luis, I'm not positive in this regard:

    #pragma iso_9899_1999;

  • new features of CVI 9.0

    is it possible to have a list of all the novelties of the CVI 9.0 (especially the features of C99) without having to watch a webcast?

    I'm sure I'm not the only one who can not watch a webcast to work, also broadcasting on the Web is not subtitled and I do not have his work. Finally, and above all, many users of this forum is not the native English speakers and will not understand anything of this speech.

    Thank you very much.

    Hello

    Have you seen Release Notes found here?  The information you are looking for must be there.  Please let me know if I can clarify or add to anything in this document.

    Thank you!

    NickB

    National Instruments

  • CVI 9.0 and MSVC 2008 express

    So I decided to install MSVC 2008 on the side of the CVI 9.0 because he understood now a model for him.  When you compile the release version, which uses the external compiler, MSVC complains an unknown pragma in baseTsd.h and WinNT.h.  Check the error, it has to do with the C99 extensions and the pragma is precisely "IgnoreUnreferencedIdentifiers".

    It doesn't seem bad no matter what, but anyone seeing this as well?

    Hi gtoph,

    It seems that the guards of the 3rd part of the compiler have been omitted inadvertently out of these definitions of pragma. This pragma is specific to the CVI compiler and not understood by other compilers.

    You're right, it's pretty harmless, since any compiler simply ignores unrecognized pragmas. But if you don't see the warnings, you can change the line above as this pragma definitions in these header files:

    front: #if (_CVI_C99_EXTENSIONS_ == 0)

    After: #if (_CVI_C99_EXTENSIONS_ == 0) &! defined (__TPC__)

    Please let us know!

    Luis

  • error: implicit declaration of function 'GetActiveProcessorCount' is not valid in C99. Make sure that you include the prototype for the function.

    I get the following error:

    error: implicit declaration of function 'GetActiveProcessorCount' is not valid in C99. Make sure that you include the prototype for the function.

    I've included windows.h

    which includes winbase.h

    Winbase.h contains the prototype for the function in the above error message.

    If I disable 'Require the function prototypes' and 'Building with the C99 extensions', I get the following error:

    error: Undefined symbol "_GetActiveProcessorCount" referenced in "c:\Users\Public\Documents\National Instruments\CVI\HDLC\cvibuild. HDLC_RandD\Debug\HDLC_RandD.obj ".

    I work in the ICB 2013 SP2.

    Why I get this error.

    This function is only valid in Windows 7 and later versions. Because the ICB 2013 still supports Windows XP, this feature is excluded by default from Windows headers that are provided with CVI. If you do not need to worry about the versions of Windows prior to Windows 7, however, you can include it yourself, by adding the following macro in the dialog box options generation CVI (be sure to include for all configurations):

  • CVI 2013 can be found at #include < rs232.h >

    Hi, I'm a newer version of the CVI.

    my program works well in 2010,

    Initially it alos works well in 2013.but now it has the folloing error.

    the following instructions are needed in 'rs232, c', #include you want to add to the top of the file. (RS232.c) is the name of the c file).

    I click Yes, but it does not work

    the c file was already a "#inclue ".

    is there something important that I get bored?

    TKS

    Build status (rs232.prj - Debug)
    RS232.c - 8 errors
    29, 5 error: implicit declaration of function 'OpenComConfig' is not valid in C99. Make sure that you include the prototype for the function.
    31, 5 error: implicit declaration of function 'SetCTSMode' is not valid in C99. Make sure that you include the prototype for the function.
    31, 18 error: the use of the identifier not declared "LWRS_HWHANDSHAKE_OFF".
    35, 5 error: implicit declaration of function 'FlushInQ' is not valid in C99. Make sure that you include the prototype for the function.
    36, 5 error: implicit declaration of function 'FlushOutQ' is not valid in C99. Make sure that you include the prototype for the function.
    80, 20 error: implicit declaration of function 'GetInQLen' is not valid in C99. Make sure that you include the prototype for the function.
    83, 18 error: implicit declaration of function 'ComRd' is not valid in C99. Make sure that you include the prototype for the function.
    180, 14 error: implicit declaration of function 'ComWrt' is not valid in C99. Make sure that you include the prototype for the function.
    Build failed.

    Hello shayisi,

    CVI displays the error dialog box, because it has detected that some functions declared in rs232.h are used in your source file, so he offers to include the header file.

    I would like to ask you to provide some more details about your configuration, so that we can determine if there is a possible bug with CVI 2013:

    1. You are able to build the projects in the sample from the file \rs232?
    2. You have a rs232.c file that is part of your project?
    3. I understand that your project used to build without errors in CVI 2010. Is this correct?
    4. What options have you selected in the Options of language C, one of the options"Compiler Options?

    Thank you!

  • Compiler of CVI 2013: increment / decrement operator assessment

    Trying to pull an old project forward to 2013 CVI, I met a challenge, which is documented as follows:

    «In the summons, the value of the right operand is evaluated before indexing table is made in the left operand.» Expressions, such as a[i] = i++; will assess differently in LabWindows/CVI 2013 compared to previous versions. »

    (There is a somewhat related thread here to do with the order of function arguments are evaluated).

    This change in the order of evaluation is shocking to me. I guess there is some C history behind it, and I won't be able to change that.

    So my question is: what is the way easiest to identify all sites in my code where this could concern me? I ~ 75 000 lines of legacy code. Maybe some regex magic?

    Thank you

    Ian

    Hello

    I'm happy to help you.

    I have test the latest version of clang (3.7 builded SVN), and I can confirm that it detects this 'problem' as a warning (and many other warnings too).

    Also it can integrate with the IDE CVI as external compiler, so it is easy to switch from a regular compiler CVI and this one. I can write a few small "guide" later, if you are interested.

  • Sapera LT with CVI

    Now this is heresy...

    Anyone could use a framegrabber DALSA and the Sapera LT C programming API to capture video from a CVI application?

    DALSA announces a C API language, it is not certain that it is possible to work with something else using PVC as a C compiler (which it can do - PCV is also a compiler C89 but not a C99 compiler).

    Thank you.

    You can do with the api of 'base' which is a Sapera ANSI C interface.  I had to UNDEF as some multiply integer type limits, then he compiled, linked and ran everything is OK.  I used the interface "framegrabber' rather than the 'camera' interface or"peripheral"to catch a ground test on a simulator.  I used the CCA and .cvi files that I created using CamExpert.

    I did it with CVI 9.1, WinXP SP3, will undermine LT 7.0.0, X 64 driver 1.5.  Works with single and double head X 64 acquisition cards.

    So using a framegrabber NOR is nice, it is also possible to use a framegrabber DALSA of CVI.

    Menchar

  • Mathematical functions in C99

    Hello everyone once again.

    I try to use the mathematical functions from C99: nearbyint, round, exp2, cbrt, etc... But they do not appear to be defined in the CVI2013 header file.

    I previously would compile the (with gcc) only if __STDC_HOSTED__ has been defined, but it seems that, even if she does not appear in the predefined options listed in the build options, this macro is now defined in CVI2013...

    So if CVI is now compatible with C99, where are the features? And if not, how do I know if they are present or not, below #ifdef _CVI_?

    Note the test seems to be:

    #if _XOPEN_SOURCE > = 600 | _ISOC99_SOURCE | _POSIX_C_SOURCE > = 200112L

    C99 present mathematical functions

    #endif

    gdargaud wrote:

    So if CVI is now compatible with C99, where are the features? And if not, how do I know if they are present or not, below #ifdef _CVI_?

    Nobody said so..., see here

  • How can I use the clang of command-line compiler?

    It is said in the new update clang is a command line tool.

    Do you have, or wish to develop, C, C++, Objective-C or Objective-C++ code you want to compile it on the command line with the clang compiler? It is a facility that is optional and not included with OS X.

  • The interface of the AVI with the PC using LabWindows/CVI

    Hi friends,

    I have a vector Network Analyzer Keysight Technologies / Agilent Technologies N5230A. I want to run with the LabWindows/CVI to measure channel 40 GHz. I want to interface the AVI with the PC using LabWindows/CVI. It is really essential for the measures, and I have no experience in doing these things. Would you please direct me to the best, easy as possible of this work? I'm really conscious of the fact that and thank you for your time and concern.

    Mohamed

    I have a vector Network Analyzer Keysight Technologies / Agilent Technologies N5230A. I want to run it with the LabWindows/CVI and measure channel 40 GHz. I want to interface the AVI with the PC using LabWindows/CVI. It is really essential to me, and I have no experience in doing these things. Would you please direct me to the track better, easy and correct these work? I'm really conscious of the fact that and thank you for your time and concern.

    Mohamed

  • CVI executable causes an on update of Windows 10 anniversary 0xC0000005 Access Violation.

    Created executables always causes an Access Violation (0xc0000005 exception) to the closing period on Windows 10 RS1 (update of the anniversary).

    This problem occurs in LabWindows CVI 2015 and 2015 SP1.

    How to reproduce: simple program to create and compile with the (x 86) release profile by default.

    for example:

    #include "test.h".

    int ph;

    int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine, int nCmdShow)
    {
    If (InitCVIRTE (hInstance, 0, 0) == 0)
    Returns - 1; / * memory * /.

    pH = LoadPanel (0, "test.uir", group of EXPERTS);
    DisplayPanel (ph);
    RunUserInterface();

    return 0;
    }

    int CVICALLBACK CallExit (int, int int event, control panel,
    void * callbackData, int eventData1, int eventData2)
    {
    switch (event)
    {
    case EVENT_COMMIT:
    QuitUserInterface (0);
    break;
    }
    return 0;
    }

    The problem is visible on the control panel > reliability history > Error Reporting:

    Also the code of the executable file (exit code) is always 0xc0000005 instead of zero.

    To check out more easily code can be called the executable through file .bat:

    off @echo
    Test.exe
    echo ExitCode = %ERRORLEVEL%
    pause

    I have observed that if multiple instances of the same program are running, only block when the last instance is closed. It seems that the problem occurs at the time that the CVI runtime is released from the ram. (The latter is only a guess)

    Hello

    We did some research and saw that the failure is related to some police files in

    c:\Windows\SysWOW64\cvirte\fonts

    c:\Windows\System32\cvirte\fonts

    Could you try deleting these files and see if the heater is always performed. If this isn't the case, it would be a work around if you do not use these fonts.

    We continue the investigation to see the exact cause

  • Real-time execution trace toolkit to optimize the Labwindows/CVI code

    Hello

    I am trying to optimize a code in real-time in LabWindows/CVI by minimizing the time of each section of the code is taking and find bottlenecks in the code. I check this time using the real-time execution trace toolkit.

    However, I just found it seems to be a constant error when you use the tool of real-time execution trace.

    When I put the traceviewer 'start' and 'stop' right after the other, I get around shift schedule 9us. It seems that the CPU will in some "idle" after the start of the trace mode, or maybe it's the time of communication or something.

    I'd appreciate it if someone could give me an idea of why this is happening. The time of real-time application window is very limited and I'm trying to minimize the time as much as possible. Even the United States 9 error is difficult to resell.

    I used the following code:

    TraceConfigure (1, 1, 0, 25000, NULL);
    TraceStart ();
    TraceStopAndSend (HOST_ADDRESS);

    and there is a photo in the toolkit of real-time execution trace.

    Thank you.

    Generally, you might be better off picking off the clock at the beginning and end of what you want to track. RTETT my introduce overhead that becomes difficult to quantify... Which is what you probably already see. The debug mode will also implement a ton of overhead. Then... Destemming of the clock in release mode will probably give you you the best estimate.

Maybe you are looking for

  • Ubuntu on Qosmio F750-120

    Hi guys,. I have a problem with my new laptop, I had difficulties to install Ubuntu, because the default configuration of the boot cd does not start, I had to press F6 and use custom configuration to start, wen I install I can not install video drive

  • brightest pixel by rank

    Hi all I try to write a code that gives the brightest pixel by rank of a picture and the value 255 and all others 0.  I have the code that does this, but it's extremely slow (260-300 ms per image!).  The way I did is to change to a table and make a f

  • Try to update with error 0 x 80248015

    When you try to apply the monthly updates for Windows XP and Windows Server 2003 systems, we get error 0 x 80248015. This occurred on the previous months and resolves to Vendranges after the initial accident. A few times the update site is available

  • How to transfer Live Photo Gallery: memory stick

    opt only shown are burning CDs

  • network connection priblem

    How can I connect to the network if I had a network card problem? Pls help me...