<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58240>58240</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Op.cpp.inc cannot found Op defined in Ops.td
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tjuwhy
      </td>
    </tr>
</table>

<pre>
    I tried to create my own dialect and operations following the toy tutorial, as the error said:
```
mlir-fuzz/build/tools/mlir/examples/toy/Ch5/include/gen/Ops.cpp.inc:12:14: error: no member named 'GenOp' in namespace 'mlir::gen'
::mlir::gen::GenOp
~~~~~~~~~~~~~^
``` 

The Ops.td is shown below:
```
#ifndef GEN_OPS
#define GEN_OPS

include "mlir/Interfaces/CallInterfaces.td"
include "mlir/Interfaces/CastInterfaces.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
include "toy/ShapeInferenceInterface.td"

def Gen_Dialect : Dialect {
  //...
}

class Gen_Op<string mnemonic, list<Trait> traits = []> :
    Op<Gen_Dialect, mnemonic, traits>;

def GenOp : Gen_Op<"gen", [ ]> {
  //...
}
#endif // GEN_OPS
```

When I add operations through 
```
#include "gen/Dialect.h"
#include "mlir/IR/Builders.h"

using namespace mlir;
using namespace mlir::gen;

#include "gen/Dialect.cpp.inc"
void mlir::gen::GenDialect::initialize() { 
  addOperations <
#define GET_OP_LIST
#include "gen/Ops.cpp.inc"
      >();
}

```

The building process reported the error at the beginning.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydFdtuozj0a-DFGgQmhOSBh6ZJR5FGk9W20j5WBg7BI2Mj20w3_fo9NpDbTmerRejYPjefu0tVn4o9sZpDTawilQZmgXQnot4kqTkTUFnCZE1UD5pZrqQhjRJCvXF5JLYFlDoRO1ilkTmgj4QZjwatlSaG8TpIH4J4G8QPwTKefn_sBNdfm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