|
Josh,
The native code also needs override paired with virtual also! Here is an example taken out of Microsoft's documentation (How to: Declare Override Specifiers in Native Compilations ):
#include <stdio.h>
__interface I1 {
virtual void f();
};
class X : public I1 {
public:
virtual void f() override {}
virtual void g() override {}
};
|
|
|
|
|
George L. Jackson wrote: The native code also needs override paired with virtual also! Here is an example taken out of Microsofts documentation:
That is what I thought. The code in question was written by someone else and committed to source control yesterday. It does appear to compile and run without the virtual keyword. I think Ill have a word with him.
Interestingly the prama does not resolve the issue which would suggest that the /CLI option makes the compiler produce this error.
Thanks again for your help
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
|
Thanks again for all your help mate
We use the override keyword in our nonmanaged code to catch cases where people override a method thats not virtual
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
Hi,
I am trying to copy data from a structure
<br />
typedef struct OctetString {<br />
unsigned int length;<br />
unsigned char *value;<br />
} OctetString;<br />
I have only managed to copy the value using a for-loop and an ArrayList
<br />
OctetString* data;<br />
ArrayList^ bits = gcnew ArrayList();<br />
for(unsigned int i=0;i<data->length;i++)<br />
{<br />
bits->Add((char)*data->value);<br />
data->value++;<br />
}<br />
My question is: Is there a better way to copy the data into the ArrayList, and is
there a more suitable structure than a ArryList to handle binary data of different lengths?
/krissi
|
|
|
|
|
You could use an equivalent value class :-
value class MOctetString
{
unsigned int length;
array<unsigned char>^ value;
};
|
|
|
|
|
kristmun wrote: Is there a better way to copy the data into the ArrayList, and is
there a more suitable structure than a ArryList to handle binary data of different lengths?
They hide that information in the documentation[^]
led mike
|
|
|
|
|
Hi guys,
thanks for the advice.
It works now using the Copy method
<br />
array<unsigned char>^ value = {'a','b','c'};<br />
char* ptr = new char[value->Length];<br />
Marshal::Copy(value,0,(IntPtr)ptr,value->Length);<br />
and the other way around
<br />
int length = 3;<br />
char str[] = {'d','e','f'};<br />
char* pStr = &str[0];<br />
array<unsigned char>^ strArr = gcnew array<unsigned char>(length);<br />
Marshal::Copy((IntPtr)pStr,strArr,0,length);<br />
I didn't quite get the value class way 
|
|
|
|
|
Hi All,
My application doesnt compile if I use anything from namespace std. I have tried "using namespace std" and std::
Can anyone tell me what the problem could be?
Extremely sorry for asking a basic question. I am just a starter. Hope you all understand.
Thanks and Regards,
Anil
|
|
|
|
|
When you say it doesn't compile, what is the error ?
Did you #include what you're trying to use ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
Now the previous error disappeared. But I still get
error C2079: 'Logger::m_oStream' uses undefined class 'std::basic_ofstream<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
Can you please help? I am using Visual Studio .Net 2003
Thanks and Regards,
Anil
|
|
|
|
|
If you could post a minimal code snippet that reproduces the error, it'd be easier to figure otu what headers you are missing.
|
|
|
|
|
Are you including iostream ( not iostream.h ) ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
right chris.....i am including iostream.....any problem with that...??
|
|
|
|
|
No - you need to post your code for us to be able to help more.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
my .h file
#pragma once
using namespace std;
class Logger
{
public:
Logger(void);
~Logger(void);
private:
char *m_pFileName;
std::ofstream m_oStream;
public:
void LogMsg(char * functionName, char * condition);
};
cpp file
#include "StdAfx.h"
#include <iostream>
#include ".\logger.h"
Logger::Logger(void)
: m_pFileName(NULL)
{
m_pFileName = "E:\\projects\\something.log";
m_oStream.open(m_pFileName, std::ios_base::app);
}
Logger::~Logger(void)
{
}
void Logger::LogMsg(char * functionName, char * condition)
{
}
Thanks in Advance for any help....[ ]
|
|
|
|
|
Anil_vvs wrote: std::ofstream m_oStream;
std:: is a waste of time, you've put a using above it. However, if you want a member variable, the #include needs to be in the .h, not the .cpp. Alternatively, you can put it in an anonymous namespace in the cpp.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanx a lot Chris.....will try that...
|
|
|
|
|
I am getting live data with gmt time in a string. but I want to convert it to local AEDT time & store the time difference 'timediff' in a variable.
Thanks a lot in advance
|
|
|
|
|
G'day mate, you're in the wrong part of the world. Check out the C++/MFC forum.
Have a look at the time_t structure and the assosiated routines
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
hi
i am facing memory & handle problem when my application invoke IXMLDOMDocument::load(), even i have used IXMLDOMDocument::Release() each time when i load new xml file, but its continuously increasing the memory and handle usage,
your help will be greatly appreciated
Thanks & Regards
neeraj
neeraj
|
|
|
|
|
This is the C++/CLI forum. We help with Managed C++ here. If you are doing so kind of mix mode programming, you need to provide some sample code of your problem. Otherwise, you need to post your question in the C++ forum also with some sample code illustrating your problem.
|
|
|
|
|
hi all,
I have declared and defined a function as
inside example.h
static int func1(struct st1 ex1, ....);
inside example.c
static int func1(struct st1 ex1,...)<br />
{<br />
---<br />
---<br />
---<br />
}
I export these functions in test.h as:
extern int func1(struct st1 ex1,...);<br />
and inside test.c, I try to call func1
<br />
#include "test.h"<br />
int main( void )<br />
{<br />
<br />
---<br />
---<br />
struct st1 ex1;<br />
int f1;<br />
f1= func1(ex1,...);<br />
}
The compiler returns with the error: undefined reference to func1.
Can anyone help me with what is wrong? My guess is : that it is to do with static; as I have defined and declared the func1 as static inside the example.h & example.c? But I dont know how to resolve?
Thanks.
-- modified at 22:12 Monday 4th December, 2006
|
|
|
|
|
If your program is C, it can't possibly be managed C++. Try the Visual C++ forum.
I see no evidence that you've included example.h inside test.c
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
test.h contains all the exported functions from example.h and its definition is in example.c.
test.h is included in the test.c.
Isnt that correct? or should i inlcude example.h also inside test.c??
if a function is declared static, how can i use it in another fileby exporting it?
|
|
|
|