laurisvr
laurisvr

Reputation: 2812

Compiler error c2237 when working with modules

I am trying to change a project to use modules in visual studio. I have changed a simple class to generate a module as follows:

#pragma once

export module FieldData;

namespace Serializer
{
    class FieldData
    {
    public:
        bool nvConverted{ false };
    };
}

I've also changed the item type to 'c/c++ compiler' This results in the following error however:

error C2237: multiple module declaration

Unfortunately there seems to be no documentation on what causes c2237 or how to resolve it

Upvotes: 1

Views: 343

Answers (1)

laurisvr
laurisvr

Reputation: 2812

I figured it out. The problem was that I hadn't changed the 'Compile as' option in the project properties -> Configuration properties -> C/C++ -> Advanced. The value it needs to be is: 'Compile as C++ Module Code (/interface )'

Upvotes: 2

Related Questions