Hi,
I'm using VC++ 2008 Express.
I have a managed interface. One of it's member uses a type that is declared
later in the same file. The type implements the interface declared before.
So, I have circular relations between the two declarations.
Question: How do I have to forward-declare the struct? (C++ is still not
clever enough to see the declaration below.)
public interface class IMatrixSource
{
Matrix GetMatrix(); // error: unknown type
};
public value struct Matrix: IMatrixSource
{
public:
//.....
private:
Matrix GetValue() = IMatrixSource:: GetValue;
};
If I write "ref struct Matrix;" above the interface declaration, the
compiler says C3816, "'struct Matrix' was previously declared or defined
with a different managed modifier" at the later declaration. What is the
correct syntax?
Armin 2 1340
Armin Zingler wrote:
Hi,
I'm using VC++ 2008 Express.
I have a managed interface. One of it's member uses a type that is declared
later in the same file. The type implements the interface declared before.
So, I have circular relations between the two declarations.
Question: How do I have to forward-declare the struct? (C++ is still not
clever enough to see the declaration below.)
public interface class IMatrixSource
{
Matrix GetMatrix(); // error: unknown type
};
public value struct Matrix: IMatrixSource
{
public:
//.....
private:
Matrix GetValue() = IMatrixSource:: GetValue;
};
If I write "ref struct Matrix;" above the interface declaration, the
compiler says C3816, "'struct Matrix' was previously declared or defined
with a different managed modifier" at the later declaration. What is the
correct syntax?
Armin:
If Matrix is a value struct, it might be a good idea to forward declare it as a
value struct.
--
David Wilkinson
Visual C++ MVP
"David Wilkinson" <no******@effis ols.comschrieb
>If I write "ref struct Matrix;" above the interface declaration, the compiler says C3816, "'struct Matrix' was previously declared or defined with a different managed modifier" at the later declaration. What is the correct syntax?
Armin:
If Matrix is a value struct, it might be a good idea to forward declare it
as a value struct.
OMG, :-/ I *copied* the declaration! Don't know how this could happen.
Thanks, you're right. I'm really ashamed of this; it's so obvious.
Thanks again for your quick reply.
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: crichmon |
last post by:
Any general advice for dealing with circular dependencies? For example, I
have a situation which, when simplified, is similar to:
/////////////
// A.h
class A
{
public:
int x;
|
by: Kiuhnm |
last post by:
Is there an elegant way to deal with semi-circular definitions?
Semi-circular definition:
A { B };
B { *A };
Circular reference:
A { *B };
B { *A };
The problems arise when there are more semi-circular definitions and
|
by: jalkadir |
last post by:
Check this out... file foo.hpp includes bar.hpp, but bar.hpp includes
foo.hpp.
The compiler/linker is having a lot of problem resolving this problem.
Does anyone know if there is a way to solve this problem.
TIA
|
by: JCB |
last post by:
Hi,
I have two C file which are referencing in a circular way.
To simplify I use an example with car :
Suppose I have a program for cars.
I have car.c, structure car and functions prototypes of car.c are in a
file car.h
|
by: Mark Mackey |
last post by:
Hi all.
I've got a rather complicated circular type definition, and would
appreciate help getting it sorted out :). Cut-down code below :
8<--------------------------------------------------------
typedef enum { SOLID, NEARESTATOM } surfcoloropt;
typedef float (*FunctionCalc)(MOLECULE *, float, int *, int *, surfcoloropt, unsigned char);
| |
by: tomb |
last post by:
VS2005.
It's possible to avoid circular references like in C++?
|
by: barias |
last post by:
Although circular dependencies are something developers should normally
avoid, unfortunately they are very easy to create accidentally between
classes in a VS project (i.e. circular compile-time dependencies). But
then I started wondering how "easy" it would be to similarly make a
NON-RUNTIME circular dependency between (implicitly linked) DLLs.
Indeed authors like John Lakos, who focus on compile/link-time
dependencies (not run-time),...
|
by: Sven |
last post by:
Can someone point out source code for a safe circular buffer receiver
transmitter? It's for sending and receiving bytes via RS232.
Thanks in advance.
|
by: Mosfet |
last post by:
Hi,
I have two classes, let's call them class A and class B with mutual
dependencies as shown below and where implementation is inside .h (no cpp)
#include "classB.h"
class A
{
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |