473,513 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C3635/C3377 errors while using managed class with template parameter from another library


There is a managed C++ class (ManagedClass) defined in one library
(TestMCpp.dll), it has a method (funcTemplate) with template native
type (NativeTemplate<int>). This library is built without any errors.

There is another managed C++ project (UseTestMCpp) which uses the
ManagedClass class: it does have included header file with native type
definitions but it does not help in case with template parameters.
The explicit instantiation of the template does not help as well.

While building the second project (UseTestMCpp) MS VS .NET 2003
compiler says:

UseTest1.cpp(13) : error C3635: '::NativeTemplate<int>': undefined
native type used in 'ManagedClass'; imported native types must be
defined in the importing source code
did you forget to include a header file?
UseTest1.cpp(13) : error C3377: 'ManagedClass::funcTemplate' : cannot
import method - a parameter type or the return type is inaccessible
Source code:
The first library (TestMCpp.dll):
//--- begin of Test0.h
#ifndef TEST0_H
#define TEST0_H

template <typename Xclass NativeTemplate
{
public:
X* pointerX_;
X* nativeTemplateFunction() { return pointerX_; } ;
};
#endif
//--- end of Test0.h

//--- begin of Test1.cpp
#using <mscorlib.dll>
#include "Test0.h"

public __gc class ManagedClass
{
public:
void funcTemplate(NativeTemplate<int*n) {}
};
//--- end of Test1.cpp

And another managed C++ project:

//--- begin of UseTest1.cpp
#using <mscorlib.dll>
#using "TestMCpp.dll"

#include "../TestMCpp/Test0.h"

int main()
{
ManagedClass *x = new ManagedClass();
}
//--- end of UseTest1.cpp
How could I fix such compiler error?

Thank you in advance,
Valeriy Pikulskyy

P.S. I found a post in "microsoft.public.dotnet.languages.vc" newsgroup
that describes exactly the same issue:
http://groups.google.com/group/micro...1425fb4fcbce53
But it's dated by February, 2004, and has no answer.

Oct 4 '06 #1
1 1522
>
UseTest1.cpp(13) : error C3635: '::NativeTemplate<int>': undefined
native type used in 'ManagedClass'; imported native types must be
defined in the importing source code
did you forget to include a header file?
UseTest1.cpp(13) : error C3377: 'ManagedClass::funcTemplate' : cannot
import method - a parameter type or the return type is inaccessible
There aren't 13 lines in the UseTest1.cpp you posted. Can you indicate
which line this error message is triggered on?

Is it possible for you to try this on C++/CLI? (download Visual C++ 2005
Express if you don't have Studio 2005) An awful lot of stuff got an awful
lot easier in the new version.
>
Source code:
The first library (TestMCpp.dll):
//--- begin of Test0.h
#ifndef TEST0_H
#define TEST0_H

template <typename Xclass NativeTemplate
{
public:
X* pointerX_;
X* nativeTemplateFunction() { return pointerX_; } ;
};
#endif
//--- end of Test0.h

//--- begin of Test1.cpp
#using <mscorlib.dll>
#include "Test0.h"

public __gc class ManagedClass
{
public:
void funcTemplate(NativeTemplate<int*n) {}
};
//--- end of Test1.cpp

And another managed C++ project:

//--- begin of UseTest1.cpp
#using <mscorlib.dll>
#using "TestMCpp.dll"

#include "../TestMCpp/Test0.h"

int main()
{
ManagedClass *x = new ManagedClass();
}
//--- end of UseTest1.cpp
How could I fix such compiler error?

Thank you in advance,
Valeriy Pikulskyy

P.S. I found a post in "microsoft.public.dotnet.languages.vc" newsgroup
that describes exactly the same issue:
http://groups.google.com/group/micro...1425fb4fcbce53
But it's dated by February, 2004, and has no answer.

Oct 10 '06 #2

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

Similar topics

0
6678
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
6
2036
by: Johan Bergman | last post by:
Hi, Maybe someone can help me with this one. The following describes a somewhat simplified version of my problem, but I think it will be sufficient. I want to use class factories (virtual...
7
2117
by: Lionel B | last post by:
Greetings. The following code compiles ok and does what I'd expect it to do: ---------- START CODE ---------- // test.cpp
7
1720
by: Kristof Thys via .NET 247 | last post by:
Post a new message to microsoft.public.dotnet.languages.vc http://www.dotnet247.com/247reference/default.aspx Hello, I've been struggling for weeks with this problem, I hope I find some...
0
3911
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
1
3696
by: Maxwell | last post by:
Hello, I having having oodles of trouble using the std lib in my MC++ (VS.NET 2003) Class library. I figured out a simple sample to reproduce the errors I am having. Create a MC++ (VS.NET 2003)...
2
3344
by: Rune Vistnes | last post by:
Hey, I am trying to wrap an unmanaged library in managed c++ so that I can use this library in other .NET languages, such as C#. I've been successful for the most part this far, but I'm having a...
7
1658
by: cortfr | last post by:
If I compile the following code in my managed c++ dll... public ref class foo { public: void doSomething() { } }; public ref class bar { }; and then inspect the resulting dll using...
1
2675
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I have an VC++ MFC Win32 application that isn't working correctly when I build it with VS2005. The problem seems to be in some ADO ActiveX controls that came with VS6 and are now out of support....
0
7267
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,...
0
7175
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...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7120
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...
0
7542
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...
1
5100
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...
0
4754
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...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.