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

Undefined symbols with basic helloworld Pegged example. #161

Open
enjoysmath opened this issue Sep 27, 2015 · 2 comments
Open

Undefined symbols with basic helloworld Pegged example. #161

enjoysmath opened this issue Sep 27, 2015 · 2 comments

Comments

@enjoysmath
Copy link

Hi, compiling the basic Arithmetic example for pegged in Visual D, I'm getting:

Error 1 Error 42: Symbol Undefined _D6pegged3peg9ParseTree9__xtoHashFNbNeKxS6pegged3peg9ParseTreeZk (nothrow @trusted uint pegged.peg.ParseTree.__xtoHash(ref const(pegged.peg.ParseTree))) C:\MyProjects\D\PeggedPractice\
Error 2 Error 42: Symbol Undefined _D6pegged3peg9ParseTree11__xopEqualsFKxS6pegged3peg9ParseTreeKxS6pegged3peg9ParseTreeZb (bool pegged.peg.ParseTree.__xopEquals(ref const(pegged.peg.ParseTree), ref const(pegged.peg.ParseTree))) C:\MyProjects\D\PeggedPractice\
Error 3 Error 42: Symbol Undefined _D6pegged3peg7__arrayZ C:\MyProjects\D\PeggedPractice\
Error 4 Error 42: Symbol Undefined _D6pegged3peg9ParseTree8toStringMxFAyaZAya (const(immutable(char)[] function(immutable(char)[])) pegged.peg.ParseTree.toString) C:\MyProjects\D\PeggedPractice\
Error 5 Error 42: Symbol Undefined _D6pegged6parser42__T13GenericPeggedTS6pegged3peg9ParseTreeZ13GenericPegged6Pegged6opCallFAyaZS6pegged3peg9ParseTree (pegged.peg.ParseTree pegged.parser.GenericPegged!(pegged.peg.ParseTree).GenericPegged.Pegged.opCall(immutable(char)[])) C:\MyProjects\D\PeggedPractice\
Error 6 Error 42: Symbol Undefined _D6pegged7grammar7__arrayZ C:\MyProjects\D\PeggedPractice\
Error 7 Error 42: Symbol Undefined _D6pegged7grammar10spaceArrowFS6pegged3peg9ParseTreeZS6pegged3peg9ParseTree (pegged.peg.ParseTree pegged.grammar.spaceArrow(pegged.peg.ParseTree)) C:\MyProjects\D\PeggedPractice\
Error 8 Error 42: Symbol Undefined _D6pegged3peg530__T5namedS4956pegged3peg473__T7discardS4576pegged3peg431__T10zeroOrMoreS4116pegg43BBC026FB8ABB41C0494D653635CB0F C:\MyProjects\D\PeggedPractice\
Error 9 Error 42: Symbol Undefined _D6pegged7dynamic7grammar7grammarFAyaHAyaDFS6pegged3peg9ParseTreeZS6pegged3peg9ParseTreeZS6pegged7dynamic7grammar14DynamicGrammar (pegged.dynamic.grammar.DynamicGrammar pegged.dynamic.grammar.grammar(immutable(char)[], pegged.peg.ParseTree delegate(pegged.peg.ParseTree)[immutable(char)[]])) C:\MyProjects\D\PeggedPractice\
Error 10 Error 42: Symbol Undefined _D6pegged3peg642__T5namedS6006pegged3peg581__T4fuseS5686pegged3peg537__T15discardChildrenS5126peD787FCA5048530FFBEDA8319BFCF8F79 C:\MyProjects\D\PeggedPractice\
Error 11 Error 42: Symbol Undefined _D6pegged3peg9ParseTree6__initZ C:\MyProjects\D\PeggedPractice\
Error 12 Error 42: Symbol Undefined _D6pegged7dynamic7grammar12__ModuleInfoZ C:\MyProjects\D\PeggedPractice\
Error 13 Error 42: Symbol Undefined _D6pegged7grammar12__ModuleInfoZ C:\MyProjects\D\PeggedPractice\

It's almost as if there's some library I need to link with, but I don't see one under the pegged directory. I have the folder C:\MyProjects\D\Pegged added to the add'l imports field in the project
properties. Please show me how to fix these. I will even donate $$ if you don't have a lot of time. I love pegged. I've used it before, but I believe I included the pegged files in the project or something, but that doesn't seem proper.

@PhilippeSigaud
Copy link
Collaborator

Could you please send me the exact files you used?

@XuTpuK
Copy link

XuTpuK commented Aug 19, 2017

I confirm same problem. I use LDC2 with simple test:

import std.stdio;
import pegged.grammar;

mixin(grammar(`
Arithmetic:
    Term     < Factor (Add / Sub)*
    Add      < "+" Factor
    Sub      < "-" Factor
    Factor   < Power (Mul / Div)*
    Mul      < "*" Power
    Div      < "/" Power
    Power    < Primary ("^" Number)?
    Primary  < Parens / Neg / Pos / Number / Variable
    Parens   < "(" Term ")"
    Neg      < "-" Primary
    Pos      < "+" Primary
    Number   < ~([0-9]+)

    Variable <- identifier
`));

void main(string[] args) {
    auto tree = Arithmetic("1^7 + 2 * 3");
    
    writeln(tree);
    
    readln();
}

Command line:

ldc2 -I=C:\PathToPeggedFolder app.d

Command fails, giving same error as in report above + last lines:

app.obj : error LNK2001: unresolved external symbol _D6pegged7dynamic7grammar12__ModuleInfoZ
app.exe : fatal error LNK1120: 32 unresolved externals
Error: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\link.exe failed with status: 1120

Maybe "getting started" should include not only samples of grammar, but real usage too? (how people can use it with DMD/LDC/GDC)

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