#25 invalid use of undefined type ‘struct libvk_volume’
Opened by alittlesir. Modified

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <glib.h>
#include <libvolume_key.h>
int main(int argc, char **argv)
{
    const char *path = "/dev/mapper/myvault";  // LUKS卷的设备路径
    GError *error = NULL;
    struct libvk_volume *volume = NULL;
    volume = libvk_volume_open(path, &error);
    if (error != NULL) {
        fprintf(stderr, "Error opening volume: %s\n", error->message);
        g_error_free(error);
        exit(EXIT_FAILURE);
    }
    printf("LUKS volume: %s\n", volume->format);
    libvk_volume_free(volume);
    return 0;
}

Compile the preceding code, and output:

vk_open.c:79:39: errorinvalid use of undefined type struct libvk_volume
   79 |     printf("LUKS volume: %s\n", volume->format);

I know that the volume_key.h file was not imported, but I didn't find the file in the include directory, that is, the file was not generated when the volume_key source code was compiled.

There is only one libvolume_key.h header file. Why is there no other header file generated?


Metadata