compile error msg: Inconsistent layout information
- From: douglas@xxxxxxxxxx
- Date: 26 Dec 2005 21:47:50 -0800
I have a compile error on an extremely short, simple VC++ program that
I don't understand. The
program consists of 1 solution and 2 projects. One project is the
"main" module. The other project
defines a class which consists of 1 .h file and 1 .cpp file.
This is the error:
Inconsistent layout information in duplicated types (f_class):
(0x02000002).
NOTE: if I remove the class private "int i;" variable, the error goes
away.
==============================================================================
This is the entire build output:
==============================================================================
------ Build started: Project: f_class, Configuration: Debug Win32
------
Compiling...
f_class.cpp
Creating library...
app.res : warning LNK4221: no public symbols found; archive member will
be inaccessible
Build log was saved at "file://c:\Documents and Settings\Owner\My
Documents\programming\visual_cpp\projects\test2\f_class\Debug\BuildLog.htm"
f_class - 0 error(s), 1 warning(s)
------ Build started: Project: main, Configuration: Debug Win32 ------
Linking...
f_class.lib(f_class.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(f_class): (0x02000002).
LINK : fatal error LNK1255: link failed because of metadata errors
Build log was saved at "file://c:\Documents and Settings\Owner\My
Documents\programming\visual_cpp\projects\test2\main\Debug\BuildLog.htm"
main - 2 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 1 succeeded, 1 failed, 0 skipped
========================================================================
This is the main.cpp file in the "main" project:
========================================================================
#include "stdafx.h" // if you omit this, you get the "unexpected end of
file" message
#include "f_class.h"
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
f_class fff;
// TODO: Please replace the sample code below with your own.
Console::WriteLine(S"Hello World");
return 0;
}
==========================================================================
this is the f_class.h file in the class project:
==========================================================================
#pragma once
class f_class
{
private:
int i;
public:
f_class(void); // constructor
~f_class(void); // destructor
};
===========================================================================
this is the f_class.cpp file in the class project:
===========================================================================
#include "StdAfx.h" // if you omit this, you get the "unexpected end of
file" error
#include "f_class.h"
f_class::f_class(void) // default constructor
{
i = 0;
}
f_class::~f_class(void)
{
}
.
- Follow-Ups:
- Re: compile error msg: Inconsistent layout information
- From: douglas
- Re: compile error msg: Inconsistent layout information
- Prev by Date: Re: VC2005 Pro: IDE (Compiler ?) can't find Stdafx.h
- Next by Date: RE: Printing Question
- Previous by thread: ShowCursor(FALSE) should hide cursor!
- Next by thread: Re: compile error msg: Inconsistent layout information
- Index(es):