473,769 Members | 4,314 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linking problem - bug? please help.

Hi all, sometime I posted a problem in here where I was
getting the following error from the linker in VS C++ 2003.

Linking...
GCClass.obj : error LNK2022: metadata operation failed
(80131188) : Inconsistent field declarations in duplicated
types (types: GCClass; fields: m_blah): (0x04000001).
LINK : fatal error LNK1215: metadata operation failed
(80131130) :

At the time I was unable to produce a simple test case and
due to time constraints I had to leave the problem. I had
another go at it today and was able to produce a simple
test case. The code follows:

namespace itga
{

template<typena me Type>
class dog
{
public:
class blah {};
};

}

public __gc class GCClass
{
itga::dog<int>: :blah* m_blah;
};

If I attempt to instantiate GCClass as follows I get the
error above.

GCClass* g = new GCClass;

There are two things I can do to get rid of the error:

1. put the dog class outside the itga namespace.
2. not make the dog class a template.

Neither of these is possible nor desirable as I'm just
trying to wrap a heap of existing C++ code in .NET
wrappers and as far as I am concerned this seems perfectly
legal to me.

Does anyone have any idea what is going on here?

thanks.

Gary.
Nov 16 '05 #1
4 3016
Gary Hughes wrote:
Hi all, sometime I posted a problem in here where I was
getting the following error from the linker in VS C++ 2003.

Linking...
GCClass.obj : error LNK2022: metadata operation failed
(80131188) : Inconsistent field declarations in duplicated
types (types: GCClass; fields: m_blah): (0x04000001).
LINK : fatal error LNK1215: metadata operation failed
(80131130) :

At the time I was unable to produce a simple test case and
due to time constraints I had to leave the problem. I had
another go at it today and was able to produce a simple
test case. The code follows:

namespace itga
{

template<typena me Type>
class dog
{
public:
class blah {};
};

}

public __gc class GCClass
{
itga::dog<int>: :blah* m_blah;
};

If I attempt to instantiate GCClass as follows I get the
error above.

GCClass* g = new GCClass;

There are two things I can do to get rid of the error:

1. put the dog class outside the itga namespace.
2. not make the dog class a template.

Neither of these is possible nor desirable as I'm just
trying to wrap a heap of existing C++ code in .NET
wrappers and as far as I am concerned this seems perfectly
legal to me.

Does anyone have any idea what is going on here?


There's more to it than what you posted. Taking your sample code above and
making it into a complete program:

#using <mscorlib.dll >

namespace itga
{

template<typena me Type>
class dog
{
public:
class blah {};
};

}

public __gc class GCClass
{
itga::dog<int>: :blah* m_blah;
};

int main()
{
GCClass* g = new GCClass;
}

compiing with cl -clr compiles and links without incident. Can you post a
complete example along with compiler command-line options?

-cd
Nov 16 '05 #2
-----Original Message-----
Gary Hughes wrote:
Hi all, sometime I posted a problem in here where I was
getting the following error from the linker in VS C++ 2003.
Linking...
GCClass.obj : error LNK2022: metadata operation failed
(80131188) : Inconsistent field declarations in duplicated types (types: GCClass; fields: m_blah): (0x04000001).
LINK : fatal error LNK1215: metadata operation failed
(80131130) :

At the time I was unable to produce a simple test case and due to time constraints I had to leave the problem. I had another go at it today and was able to produce a simple
test case. The code follows:

namespace itga
{

template<typena me Type>
class dog
{
public:
class blah {};
};

}

public __gc class GCClass
{
itga::dog<int>: :blah* m_blah;
};

If I attempt to instantiate GCClass as follows I get the
error above.

GCClass* g = new GCClass;

There are two things I can do to get rid of the error:

1. put the dog class outside the itga namespace.
2. not make the dog class a template.

Neither of these is possible nor desirable as I'm just
trying to wrap a heap of existing C++ code in .NET
wrappers and as far as I am concerned this seems perfectly legal to me.

Does anyone have any idea what is going on here?
There's more to it than what you posted. Taking your

sample code above andmaking it into a complete program:

#using <mscorlib.dll >

namespace itga
{

template<typen ame Type>
class dog
{
public:
class blah {};
};

}

public __gc class GCClass
{
itga::dog<int>: :blah* m_blah;
};

int main()
{
GCClass* g = new GCClass;
}

compiing with cl -clr compiles and links without incident. Can you post acomplete example along with compiler command-line options?

-cd
.


Sorry Carl, one thing I did not mention main() needs to be
in a separate file the class #included. I can send you a
complete project if you like. If the whole thing is in a
single cpp file it works correctly as you found.

Gary.
Nov 16 '05 #3
Gary Hughes wrote:
Sorry Carl, one thing I did not mention main() needs to be
in a separate file the class #included. I can send you a
complete project if you like. If the whole thing is in a
single cpp file it works correctly as you found.


ZIP it up and post it here, or you can email to me - your choice. Do the
obvious things to my reply-to address to get a real email address.

-cd
Nov 16 '05 #4
i work with c++ team, i created two files, one header file with your class
and one cpp which #Includes the header, but we cannot repro it.
It will be great if you can send the repro project to my email address.
(remove the online ,from my address) or post a better repro. We would like
to understand as to why this doesn't work.
Mahesh
--------------------
Content-Class: urn:content-classes:message
From: "Gary Hughes" <ge*@itga.com.a u.NOSPAM>
Sender: "Gary Hughes" <ge*@itga.com.a u.NOSPAM>
References: <07************ *************** *@phx.gbl> <OU************ **@TK2MSFTNGP11 .phx.gbl>Subject: Re: Linking problem - bug? please help.
Date: Sun, 26 Oct 2003 19:27:11 -0800
Lines: 103
Message-ID: <04************ *************** *@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOcOjW1YYj2fjz USJeDNUBJ8gfyXA ==
Newsgroups: microsoft.publi c.dotnet.langua ges.vc
Path: cpmsftngxa06.ph x.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:29763
NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc

-----Original Message-----
Gary Hughes wrote:
Hi all, sometime I posted a problem in here where I was
getting the following error from the linker in VS C++2003.
Linking...
GCClass.obj : error LNK2022: metadata operation failed
(80131188) : Inconsistent field declarations induplicated types (types: GCClass; fields: m_blah): (0x04000001).
LINK : fatal error LNK1215: metadata operation failed
(80131130) :

At the time I was unable to produce a simple test caseand due to time constraints I had to leave the problem. Ihad another go at it today and was able to produce a simple
test case. The code follows:

namespace itga
{

template<typena me Type>
class dog
{
public:
class blah {};
};

}

public __gc class GCClass
{
itga::dog<int>: :blah* m_blah;
};

If I attempt to instantiate GCClass as follows I get the
error above.

GCClass* g = new GCClass;

There are two things I can do to get rid of the error:

1. put the dog class outside the itga namespace.
2. not make the dog class a template.

Neither of these is possible nor desirable as I'm just
trying to wrap a heap of existing C++ code in .NET
wrappers and as far as I am concerned this seemsperfectly legal to me.

Does anyone have any idea what is going on here?


There's more to it than what you posted. Taking your

sample code above and
making it into a complete program:

#using <mscorlib.dll >

namespace itga
{

template<type name Type>
class dog
{
public:
class blah {};
};

}

public __gc class GCClass
{
itga::dog<int>: :blah* m_blah;
};

int main()
{
GCClass* g = new GCClass;
}

compiing with cl -clr compiles and links without

incident. Can you post a
complete example along with compiler command-line options?

-cd
.


Sorry Carl, one thing I did not mention main() needs to be
in a separate file the class #included. I can send you a
complete project if you like. If the whole thing is in a
single cpp file it works correctly as you found.

Gary.


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1628
by: Rudy | last post by:
I am desperately seeking some help with a program that was supposed to have been completed last night. I have only been working with PHP for a week. I have tried and tried and tried, but I am unable to get this program to work. I posted a question earlier this week "Linking Query Results to a webpage", however I could never figure out where to add the code and my client added another complexity (open into a new window). I have a very...
0
2247
by: gasturbtec | last post by:
please help im new at access programming and i just got this project dropped in my lap because the old programmer quit. i've been doing ok so far but now i need to add code to an existing database that is used to connect to other databases and generate reports. below is sample code of how the database does the linking i hope i give you enough info to help me but if not let me know and i will give more. Sub txtShipDataFileSub() Dim...
1
1219
by: bab | last post by:
i need help linking my relational data base. some one help me please. i can link a one to one relationship but i cant link a one to many for some unknown reason. can some one please tell me how to do it its in Access 2000 by the way
2
7254
by: | last post by:
Help! I'm new to c++, and am breaking my teeth on MS Visual C++ (bundled within Visual Studio .NET 2003). Am trying to link simple c++ code to fortran dlls created in Compaq Visual Fortran (v6.1). Posts concerning this topic are common, but none of the posted solutions I've tried work correctly with the above software. The linker can't seem to find the dll (reports 'unresolved external symbol __imp__IMSL_FUN@8'; IMSL_FUN.dll is the f77...
7
2394
by: Hal Vaughan | last post by:
I have a problem with port forwarding and I have been working on it for over 2 weeks with no luck. I have found C programs that almost work and Java programs that almost work, but nothing that does what I need. I've even tried writing a port forwarder in Java and found problems that nobody seems to have the answer to in forums. I need to make it work essentially the same on both Windows and Linux. There is one program, in C, that...
1
2249
by: buchalino | last post by:
Hi Guys, Please can someone help me, I am having a linking problem . I am writing a socket program, the problem is just the linking . I am using VC++ In the process of the problem, I installed the MSDN service pack, but not sure if it has a specific directory to be installed in.
1
5961
by: srikar | last post by:
what is the difference between static linking & dynamic linking, what are the advantages of each? How to perform static linking & Dynamic linking by using gcc -o liniking will be done , but how can we control the type of linking Hi any one please help me to clarify my doubt
0
3982
by: xieml2007 | last post by:
Dear Madam or Sir, I encountered one problem which is quite similiar to the discussions launched at the web site: http://www.thescripts.com/forum/thread280324.html
0
1445
NeoPa
by: NeoPa | last post by:
If anyone can help with a problem linking across to a table in a database on a SQL 2000 server, then please visit Linking from Access over in SQL Server. I'm locking this so that any and all responses are kept in the one thread.
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10036
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7404
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.