Thread: Function Error Question

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    10

    Wink Function Error Question

    Hello Everyone,
    I was wondering if someone could give me some insight on what this error is trying to tell me?

    passing argument 3 of 'FindLstn' from incompatible pointer type [enabled by default]
    The function I'm using is:

    Code:
    FindLstn(GPIB0, Instruments, Result, 31);
    Just to troubleshoot I tried dummy constants in each argument

    Code:
    FindLstn(1,2,3,4);
    But it still returned an error.

    I looked up in the header file and the function appears to be

    Code:
    void NI488CC FindLstn       (int boardID, const Addr4882_t * addrlist, Addr4882_t * results, size_t limit);
    Which I believe has 4 arguments.

    Thanks for any help!

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Do you know what a pointer is? What are the types of Instruments and Result?

    Some documentation:
    Linux GPIB Package Homepage
    IEEE-488 - Wikipedia, the free encyclopedia

    In particular:
    FindLstn
    MakeAddr
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Aug 2012
    Posts
    10
    I'm not gonna lie to you, I do not know what a pointer is but I will study it and get back to your questions.

  4. #4
    Registered User
    Join Date
    Aug 2012
    Posts
    10
    Quote Originally Posted by oogabooga View Post
    Do you know what a pointer is? What are the types of Instruments and Result?

    Some documentation:
    Linux GPIB Package Homepage
    IEEE-488 - Wikipedia, the free encyclopedia

    In particular:
    FindLstn
    MakeAddr
    A pointer points to a memory location

    Here are the types:
    Code:
    #define GPIB0 0
    int Instruments[31];
    int Result[31];
    FindLstn(GPIB0, Instruments, Result, 31);
    Are my argument syntax wrong?

  5. #5
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Yes. Your arguments are obviously wrong. Did you read the documentation I referenced? Look at this:
    Code:
    void FindLstn(int board_desc, const Addr4882_t padList[], Addr4882_t resultList[], int maxNumResults);
    So Instruments and Result need to be Addr4882_t arrays, not int arrays. If you don't know what that is (or cannot figure it out yourself), then you probably don't know enough to be playing with this code. What exactly are you attempting to do?
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  6. #6
    Registered User
    Join Date
    Aug 2012
    Posts
    10
    Quote Originally Posted by oogabooga View Post
    Yes. Your arguments are obviously wrong. Did you read the documentation I referenced? Look at this:
    Code:
    void FindLstn(int board_desc, const Addr4882_t padList[], Addr4882_t resultList[], int maxNumResults);
    So Instruments and Result need to be Addr4882_t arrays, not int arrays. If you don't know what that is (or cannot figure it out yourself), then you probably don't know enough to be playing with this code. What exactly are you attempting to do?
    No argument with respect of me not understanding the code (this is why I'm practicing) - no pun intended.

    I am trying to compile the 4882query.c example which is distributed in the National Instruments 488.2 executable on NI-488.2 3.0.2 - National Instruments. I need to learn this code because I need to perform tedious repeated measurements on test equipment.

    I appreciate your feedback.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    Aug 2012
    Posts
    10
    I fixed it! I had changed the initial array around and screwed it up. I changed it back to:

    Addr4882_t Instruments[32], // Array of primary addresses
    Result[31]; // Array of listen addresses
    and now it compiles.

    Thanks for your help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error "in function 'main' syntax error before 'int' Help Please
    By blackhat11907 in forum C Programming
    Replies: 5
    Last Post: 08-20-2011, 07:05 PM
  2. Replies: 8
    Last Post: 07-08-2011, 01:16 PM
  3. Error: _ defined as a function returning a function?
    By Jardon in forum C Programming
    Replies: 15
    Last Post: 07-29-2009, 11:53 AM
  4. function calling within another function error
    By bazzano in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 01:40 AM
  5. Question on function syntax and calling function
    By cbrman in forum C Programming
    Replies: 10
    Last Post: 10-05-2003, 05:32 PM

Tags for this Thread