I know that the program I am decompiling uses openSSL.
I'd like to add the types from the include folder of the project to the data types.
To do that, I use File => Parse C Source.
I then select the include folder from the openSSL project

For every parse configuration I get

Encountered "<EOF>" at line 0 column 0
Was expecting one of:

And if I try to import a subset of the .h files I get the following error because some types are not defined directly in the file.

C parser: Encountered errors during parsing

Is there a way to import all the types from the source of a project ?

1 Answer 1


The C parser of Ghidra has various issues, e.g. it has a less extensive list of sane preprocessor variables and it just completely chokes on GCC attributes. I personally tried some approaches to make this work better, e.g. using the clang/gcc preprocessor to dump one giant header file, but they are still highly experimental and probably require a lot of tinkering, so I would overall just declare the C Parser as an nonviable approach for your problem.

The best way that I have heard of so far is to compile the library with full debug symbols in the version and target you need, then import that into Ghidra. Ghidra should then parse all the PDB/DWARF type information, create all the relevant types and apply the function signatures. Then you can link the library file to the binary you want to analyze in the first place, and propagate that information to it. I don't know a tutorial for that right now, but Ghidra has good support for such projects that involve multiple binaries. If you encounter any issues with that, those are most likely worth a separate dedicated question, because this is then the same process as propagating type information from a library that you had to reverse engineer too.

Edit: I needed to do this recently and wrote it up as a small blogpost.

The general approach is like I described, but the blogpost itself isn't in a format and as polished as I'd like a StackExchange answer to be, so I don't think that copying it here would be appropriate.

  • For anyone else who got here and is lost, check out the page "Data Type Manager" in the built in help under "Help->Contents". Or search for "archive" in the help. Jun 17, 2021 at 1:12
  • 1
    I find it hilarious that I got a reminder email because of your comment that made me remember this post, after I published a blogpost about this yesterday. Edited the post to include this Jun 18, 2021 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.