473,659 Members | 2,685 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: '::NativeTempla te<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* nativeTemplateF unction() { return pointerX_; } ;
};
#endif
//--- end of Test0.h

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

public __gc class ManagedClass
{
public:
void funcTemplate(Na tiveTemplate<in t*n) {}
};
//--- end of Test1.cpp

And another managed C++ project:

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

#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.publ ic.dotnet.langu ages.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 1532
>
UseTest1.cpp(13 ) : error C3635: '::NativeTempla te<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* nativeTemplateF unction() { return pointerX_; } ;
};
#endif
//--- end of Test0.h

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

public __gc class ManagedClass
{
public:
void funcTemplate(Na tiveTemplate<in t*n) {}
};
//--- end of Test1.cpp

And another managed C++ project:

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

#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.publ ic.dotnet.langu ages.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
6693
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 Visual Basic .NET version of this article, see 308049. For a Microsoft Visual C++ .NET version of this article, see 310071. For a Microsoft Visual J# .NET version of this article, see 320627. This article refers to the following Microsoft .NET...
6
2046
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 constructors) which have this base class: template<class T>
7
2124
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
1735
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 help here...
0
3931
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. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
1
3719
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) class library and type in the following code below: #include <map> #include<string>
2
3361
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 hard time figuring out how to wrap template classes. I'm getting an C3231 compile error when I try to use the generic type as a template type. Here's an example from the MSDN C3231 compile error site:
7
1662
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 ildasm... I can see that foo
1
2686
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. So, I have decided to solve the problem by using a mixed assembly: Most of the program will be my MFC - based code (unmanaged), but I will implement one dialog box as managed code. In my original MFC app, this dialog box contains the problem ActiveX...
0
8330
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,...
1
8523
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
8626
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...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
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
5649
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();...
1
2749
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 we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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.