Hello.
I'm developing a Win32 Console Application for a Smart Device (MotoQ).
All i need to do is delete a file with a known name and path. I'm
under the impression that I have to use File::Delete( path ) based on
what MSDN is telling me. Thus I need to include mscorlib.dll ... I
#using this and the method cannot be found. I have tried almost
everything and am completely confused.
#using <C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll>
using namespace System;
using namespace System::IO;
#include "stdafx.h"
#include <Tlhelp32.h>
#include <windows.h>
#include <commctrl.h>
void installCab(LPTSTR cabFile);
void installCabs(LPCTSTR directory);
bool checkIfWCELOADIsRunning();
void removeInstallFiles();
void removeInstallFiles()
{
Delete(" ");
}
ERRORS:::
Error 1 error C3861: 'Delete': identifier not found Installer.cpp 64
ANY IDEAS?!?!
thanks, smp
> Hello.
>
[quoted text clipped - 5 lines]
> #using this and the method cannot be found. I have tried almost
> everything and am completely confused.
It looks like you might be mixing managed and unmanaged code in an odd way.
If you're doing Managed code, then you would want call
System::IO::File::Delete, but you're trying to call ::Delete, which doesn't
exist. Given the using directives that you have in force, File::Delete
should be a sufficiently qualified name.
If, on the other hand, you're writing pure native code, just call the
::DeleteFile function from the Win32 API and forget about using the CLR
function to do it.
For that matter, since you're writing in C++, you can simply use
::DeleteFile no matter what - the compiler will "do the right thing" to make
it work from managed or native code.
-cd
smp9737@gmail.com - 31 Jul 2007 15:13 GMT
On Jul 31, 10:02 am, "Carl Daniel [VC++ MVP]"
<cpdaniel_remove_this_and_nos...@mvps.org.nospam> wrote:
> smp9...@gmail.com wrote:
> > Hello.
[quoted text clipped - 23 lines]
>
> -cd
Awesome, that seemed to have worked (::DeleteFile)
Ben Voigt [C++ MVP] - 03 Aug 2007 20:43 GMT
>> Hello.
>>
[quoted text clipped - 21 lines]
> ::DeleteFile no matter what - the compiler will "do the right thing" to
> make it work from managed or native code.
I was under the impression that Smart Device runtime can't do C++ interop
(aka It Just Works), so you need to stick with either purely managed code or
purely unmanaged code, and can't use ::DeleteFile Win32 API function from a
managed assembly (at least, you'd need DllImport attribute and use
p/invoke).
> -cd
Carl Daniel [VC++ MVP] - 07 Aug 2007 16:47 GMT
> I was under the impression that Smart Device runtime can't do C++
> interop (aka It Just Works),
I believe you're right - I missed the Smart Device part of the question when
I replied. Mea culpa!
-cd