From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

incomplete struct

Hi all,

I created C program under Visual C++.
Compilation was done without any mistake.

I try to compile it under LabWindows/CVI 6.0, and
I have one error:
"Type error in argument 3 to `LoadFromFile'; found 'pointer to pointer
to struct FileData' expected 'pointer to pointer to incomplete struct
FileData defined at ElementOperations.h:182'."

I don't understand what is "incomplete struct" ?

Here is the "wrong code", the error is on the argument pFileData:

struct FileData* pFileData = 0;
.....
resFunction = ElementOperations_LoadFromFile(pElementOperation,
szFCFilePath, &pFileData, &errorInfo);
***********************
***********************
Here the prototype of the function ElementOperations_LoadFromFile:
EXPORTIMPORTDEF HRESULT ElementOperations_Load
FromFile
(
struct MotFCElementOperations* pTheObject,
const char* szFileName,
struct MotFCFileData** returnVal,
struct MotSErrorInfo* pErrorInfo
);
***********************
***********************
And here the definition of the structure:
struct MotFCFileData
{
long lReserved;
};

Any help is welcome.

Thank you.
Sébastien FUSILIER
0 Kudos
Message 1 of 4
(2,929 Views)
Sébastien,

It looks like pFileData is of type struct FileData*. Shouldn't it be of type struct MotCFFileData* instead?

- luis
0 Kudos
Message 2 of 4
(2,929 Views)
Sorry I make a mistake,
here the good prototype:

EXPORTIMPORTDEF HRESULT ElementOperations_LoadFromFile
(
struct ElementOperations* pTheObject,
const char* szFileName,
struct FileData** returnVal,
struct ErrorInfo* pErrorInfo
);

and the good definition of the structure:

struct FileData
{
long lReserved;
};


Sebastien.
0 Kudos
Message 3 of 4
(2,929 Views)
Okay, I see the problem now. This is happening because your LoadFromFile declaration takes place before the full definition of struct FileData. Because of that, the function uses the "incomplete" version of the data type, whereas the pFileData parameter (because there is an actual variable involved) uses the fully resolved structure definition. Hence the mismatch during compilation.

You can fix it by moving the struct FileData definition above the function declaration.

- luis
0 Kudos
Message 4 of 4
(2,929 Views)