class template has already been defined!!

Hi,

I have a static library made up of many C++20 modules and many of them #include <system_error> in the section between module and export module, like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module;

#include <sqlite3.h>
#include <memory>  //  std::unique_ptr/shared_ptr, std::make_unique/std::make_shared
#include <system_error>  //  std::system_error
#include <string>  //  std::string
#include <type_traits>  //  std::remove_reference, std::is_base_of, std::decay, std::false_type, std::true_type
#include <functional>  //   std::identity
#include <sstream>  //  std::stringstream
#include <map>  //  std::map
#include <vector>  //  std::vector
#include <tuple>  //  std::tuple_size, std::tuple, std::make_tuple, std::tie
#include <utility>  //  std::forward, std::pair
#include <algorithm>  //  std::for_each, std::ranges::for_each
#include "cxx_optional.h"
#include "config.h"
#include "cxx_universal.h"

export module storage;
import cxx_functional_polyfill;
import static_magic;
import mpl;
import tuple_traits;
import tuple_filter;
import tuple_iteration;
import type_traits;
import alias;
import row_extractor_builder;
import error_code;



I now import 2 modules that have this same declarations except for the module name.

The fact that both modules include <system_error> is an implementation choice and should not be "exported from either modules"

However when I have an executable that links with this library, and I import both modules I get



 
system_error(38,42): error C2953: 'std::is_error_code_enum': class template has already been defined



Why????


I am using VS2022 preview version and the library compiles pewrfectly....

what could be happening?

Last edited on
Topic archived. No new replies allowed.