Help: Compiler is trying to convert identical variable arguments .c and .h files

This is a discussion on Help: Compiler is trying to convert identical variable arguments .c and .h files within the Linux Programming forums, part of the Platform Specific Boards category; Ok, here is a strange problem I have been having: In the header file, the following function is declared: Code: ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    33

    Help: Compiler is trying to convert identical variable arguments .c and .h files

    Ok, here is a strange problem I have been having:

    In the header file, the following function is declared:

    Code:
    int setup1394(dc1394_cameracapture *camera, dc1394camera_t, uint_t exposure);
    In the main code the following is declared:

    Code:
    dc1394_cameracapture capt;
    ...
    if (dc1394_dma_capture(&capt,1,DC1394_VIDEO1394_WAIT)!=DC1394_SUCCESS)
    When I try to compile the code, this function gives me problems related to the variables capt:

    Moire.c:209: error: conversion from ‘dc1394_cameracapture*’ to non-scalar type ‘dc1394_cameracapture’ requested
    For some reason, it is trying to convert the variable capt to a different type of variable, even though they should be the same. Almost looks like a problem with pointers, but I am not familiar enough with the nuisances of pointer to understand what is going on here. Can anyone clear this problem up for me.

    Thanks.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Post the prototype of the function you're actually calling (dc1394_dma_capture). I'm sure you'll find that the first argument is missing a * in the type.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    I thought that the function in the header file was the prototype.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    The prototype you posted declares a function called "setup1394". If line 109 is the if statement you posted, the error is on a call to a function called "dc1394_dma_capture". Do you notice the slight difference?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    Oh sorry, I posted the wrong line of code. There actually was a problem with the prototype I had posted, but I fixed it now.

    Thanks anyway.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. .h file vs .c file
    By RocketMan in forum C Programming
    Replies: 5
    Last Post: 05-13-2008, 07:28 PM
  2. Replies: 4
    Last Post: 12-14-2005, 01:21 PM
  3. .h files: "constant already defined"
    By wakeup in forum C++ Programming
    Replies: 11
    Last Post: 11-22-2005, 04:31 AM
  4. Difference between .h and .c files
    By Metalix in forum C Programming
    Replies: 9
    Last Post: 01-19-2005, 07:38 PM
  5. placement of (.h) and (.cpp) files..!?
    By matheo917 in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2003, 05:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21