Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate AST for Single file #17

Open
VenoVeno opened this issue Mar 3, 2023 · 2 comments
Open

How to generate AST for Single file #17

VenoVeno opened this issue Mar 3, 2023 · 2 comments

Comments

@VenoVeno
Copy link

VenoVeno commented Mar 3, 2023

After building in Linux using the steps https://github.com/satya-das/cppparser#building-cppparser.

cppparsertest binary is generated.

How to Parse a single file?

@manuel5975p
Copy link

You can use it as a library like this:

#include <string>
struct A{
    std::string x;
};
#include "cppparser.h"
#include <filesystem>
#include <iostream>

namespace fs = std::filesystem;
int main(){
    CppParser parser;
    const auto ast                    = parser.parseFile(std::string("path/to/your/file.cpp"));
}

Then compile, adding pub to your include dirs and linking boost_filesystem, boost_program_options and boost_system, which should have been generated in your build directory.

@dandelion915
Copy link

image

I get the following errors when building, could you give some hints how to solve it?

When you referring to " linking boost_filesystem, boost_program_options and boost_system" , does this mean adding the following dirs to the linking path?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants