I need some help converting this to C++

A

AA2e72E

[I would have asked this in a C++ forum but the one I found is empty!]

System.IO.Directory.CreateDirectory(path);
return System.IO.Directory.Exists(path);

I want to bury this in a C++ Win32 Project. My effort so far (that does not
work and I do not understand the error messages) is:

#using <mscorlib.dll>

using namespace System;
using namespace System::IO;

bool* _clrcall;bool CDirectory(String path)
{
DirectoryInfo d = Directory::CreateDirectory(path);
return (d.Exists(path));
}

I get

Error 1 fatal error C1190: managed targeted code requires a '/clr'
option WCALL_DLL
Error 3 error C3149: 'System::String' : cannot use this type here without a
top-level '^'
Error 4 error C2664:
'System::IO::DirectoryInfo::DirectoryInfo(System::String ^)' : cannot convert
parameter 1 from 'System::IO::DirectoryInfo ^' to 'System::String ^'
Error 5 error C2064: term does not evaluate to a function taking 1 arguments


I don't know why I am getting Error 1 as I have set Common Language Runtime
Support to

Common Language Runtime Support (/clr)


Many, many thanks.
 
P

PvdG42

AA2e72E said:
[I would have asked this in a C++ forum but the one I found is empty!]

System.IO.Directory.CreateDirectory(path);
return System.IO.Directory.Exists(path);

I want to bury this in a C++ Win32 Project. My effort so far (that does
not
work and I do not understand the error messages) is:

#using <mscorlib.dll>

using namespace System;
using namespace System::IO;

bool* _clrcall;bool CDirectory(String path)
{
DirectoryInfo d = Directory::CreateDirectory(path);
return (d.Exists(path));
}

I get

Error 1 fatal error C1190: managed targeted code requires a '/clr'
option WCALL_DLL
Error 3 error C3149: 'System::String' : cannot use this type here without
a
top-level '^'
Error 4 error C2664:
'System::IO::DirectoryInfo::DirectoryInfo(System::String ^)' : cannot
convert
parameter 1 from 'System::IO::DirectoryInfo ^' to 'System::String ^'
Error 5 error C2064: term does not evaluate to a function taking 1
arguments


I don't know why I am getting Error 1 as I have set Common Language
Runtime
Support to

Common Language Runtime Support (/clr)


Many, many thanks.

Here are the appropriate active groups.

For ISO standard C++:

microsoft.public.vc.language

For C++/CLI:

microsoft.public.dotnet.languages.vc

Both groups have active "volunteer" members who are very good at what they
do, so I'm sure you'll find the help you need.
 
A

AA2e72E

Thanks, I've reposted the question.

AA2e72E said:
[I would have asked this in a C++ forum but the one I found is empty!]

System.IO.Directory.CreateDirectory(path);
return System.IO.Directory.Exists(path);

I want to bury this in a C++ Win32 Project. My effort so far (that does
not
work and I do not understand the error messages) is:

#using <mscorlib.dll>

using namespace System;
using namespace System::IO;

bool* _clrcall;bool CDirectory(String path)
{
DirectoryInfo d = Directory::CreateDirectory(path);
return (d.Exists(path));
}

I get

Error 1 fatal error C1190: managed targeted code requires a '/clr'
option WCALL_DLL
Error 3 error C3149: 'System::String' : cannot use this type here without
a
top-level '^'
Error 4 error C2664:
'System::IO::DirectoryInfo::DirectoryInfo(System::String ^)' : cannot
convert
parameter 1 from 'System::IO::DirectoryInfo ^' to 'System::String ^'
Error 5 error C2064: term does not evaluate to a function taking 1
arguments


I don't know why I am getting Error 1 as I have set Common Language
Runtime
Support to

Common Language Runtime Support (/clr)


Many, many thanks.

Here are the appropriate active groups.

For ISO standard C++:

microsoft.public.vc.language

For C++/CLI:

microsoft.public.dotnet.languages.vc

Both groups have active "volunteer" members who are very good at what they
do, so I'm sure you'll find the help you need.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top