error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (SRC): (0x020001f3).

I am trying to fix some module which I have started to do two months ago.
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
31
class SRC {  
public:
    SRC();
	std::vector<OPTIONS*> Options;
	
	struct RGB { int r; int g; int b; } rgb;
	struct HSV { float h; float s; float v; } hsv;
	struct STAT { float min; float max; } stat;
    
	std::map<COORDS,std::string> Files; // source file(s)
	std::vector<std::string>::iterator fileit; // File iterator
	std::string file; // file name

	LIMITS2 Limits;
	REGEX Regex;
	char * subFolder;

	bool join;
	__BITMAP bitmap;
};

class TARGET {  
public:
	TARGET();
	class _Bitmap: public __BITMAP {
	};
	struct RGB { int r; int g; int b; } rgb;
	struct HSV { float h; float s; float v; } hsv;
	struct STAT { float min; float max; } stat;
	std::string file; // Destinations file
};

(highlited here http://paste.ofcode.org/jfkPsvjXtUqffyMjJK7ukR)

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
31
32
33
#include "stdafx.h"
SRC::SRC(){
    rgb.r=-1;
	rgb.g=-1;
	rgb.b=-1;
	hsv.h=-1;
	hsv.s=-1;
	hsv.v=-1;
	stat.min=-1;
	stat.max=-1;
	Limits.xmin=-1;
	Limits.xmax=-1;
	Limits.ymin=-1;
	Limits.ymax=-1;
	Regex.first;
	Regex.second;
	Regex.prefix;
	Regex.suffix;
	Regex.mid;
	Regex.ext;
	Regex.regext;
};
TARGET::TARGET(){
	rgb.r=-1;
	rgb.g=-1;
	rgb.b=-1;
	hsv.h=-1;
	hsv.s=-1;
	hsv.v=-1;
	stat.min=-1;
	stat.max=-1;
};

(highlighted here http://paste.ofcode.org/PUHdDusnRD2NpnZgF8aJLY)

Structs are defined here:
http://paste.ofcode.org/ijwC4zyLqnqqEW6aQ2ihsP

The error which I got is:
1
2
singleton.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (SRC): (0x020001f3).
1>LINK : fatal error LNK1255: link failed because of metadata errors


Yet the singleton:
http://paste.ofcode.org/ehQdLGWZfAqvWu36Yi83hY

The map container in SRC should keep paths of source files defined by regex.
The singleton should have vector of Sources, so every element of Sources can have map container of source files.

What causes the error and how to fix it?
Last edited on
There is not real solution. Do you think it has something to do with multithread debug?

This is linker messaging with verbose:
http://paste.ofcode.org/spxmskrj236UrQtDn4a2TG
I dont know why this was like that but the original code that worked is here:
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
31
class SRC {  
public:
	SRC();
    std::vector<OPTIONS*> Options;
	
	struct RGB { int r; int g; int b; } rgb;
	struct HSV { float h; float s; float v; } hsv;
	struct STAT { float min; float max; } stat;
    
	static std::map<COORDS,std::string> Files; // source file(s)

	static std::vector<std::string>::iterator fileit; // File iterator
	static std::string file; // file name
	LIMITS2 Limits;
	REGEX Regex;
	static char * subFolder;

	bool join;
	__BITMAP bitmap;
};

class TARGET {  
public:
	TARGET();
	class _Bitmap: public __BITMAP {
	};
	struct RGB { int r; int g; int b; } rgb;
	struct HSV { float h; float s; float v; } hsv;
	struct STAT { float min; float max; } stat;
	std::string file; // Destinations file
};

Notice the static keywords above.


Implementation:
1
2
3
4
5
6
std::map<COORDS,std::string>  SRC::Files;
std::string SRC::file = "";

LIMITS2 Limits;
REGEX Regex;
char * SRC::subFolder = "";


I thought that because the singleton creates instances of Sources and Destinations
1
2
std::vector<SRC> Sources;
std::vector<TARGET> Destinations;

I don't need to have the map containers to be static. I thought it has more sense to create more instances of them (elements of the Sources or Destinations) But then I remove the static keywords and the implementation so this is the error what was in the question.
Last edited on
Topic archived. No new replies allowed.