'How to create a global pointer variable for a custom structure in llvm

I define a structure in the header file types.h:

typedef struct{
char str [10].
void *p.
}for_test;

In Pass, I first refer to the header file. I want to create a global pointer in pass to access the structured array.

#include ".. /types.h"
...
static StructType *fp_type = llvm::StructType::getTypeByName(C,"for_test");
GlobalVariable *F_Pointer = new GlobalVariable(
M, PointerType::get (fp_type, 0), false,
GlobalValue::ExternalLinkage, 0, "f_p");

However, PointerType::get (fp_type,0) has an error and I don’t know how to fix it. Error:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source