Groups | Blog | Home
all groups > dotnet clr > may 2006 >

dotnet clr : How to resolve :Error 1 Command line error D8016 : '/MT' and '/clr:oldsyntax' command-line


mohan NO[at]SPAM tek.com
5/23/2006 10:30:47 PM
Hi all,
I have ported my project from VS2003 to VS2005
The project contains both unmanaged codeand managed code.While
compiling
I got the following errors:
Error 1 Command line error D8016 : '/MT' and '/clr:oldsyntax'
command-line
options are incompatible cl "
Can anyone help me to resolve this error?
Thanks,
Mohan
--
Barry Kelly
5/24/2006 12:00:00 AM
[quoted text, click to view]

I've just looked at the documentation for the '/clr' switch. It says, in
the documentation, this:

---8<---
By default, /clr is not in effect. When /clr is in effect, /MD is also
in effect (see for /MD, /MT, /LD (Use Run-Time Library) more
information). /MD ensures that the dynamically linked, multithreaded
versions of the runtime routines are selected from the standard header
(.h) files. Multithreading is necessary for managed programming in part
because the CLR garbage collector runs finalizers in an auxiliary
thread.
--->8---

Does this help?

-- Barry

--
mohan NO[at]SPAM tek.com
5/24/2006 2:35:31 AM
hanks Barry. But after selecting /MD options ,I am getting some
different error.

Error 1 error C2440:cannot convert from '__const_Char_ptr' to 'wchar_t
__gc *' 28


Can you please let me that how can I convert? I have tried reinterpret.
But it does not convert.
For your reference I have attached the piece of code:

wchar_t __gc* GetAssemblyPath()
{
return PtrToStringChars(Assembly::GetExecutingAssembly()->Location);
}

Thanks,
Mohan
Barry Kelly
5/24/2006 11:11:40 AM
[quoted text, click to view]

It helps when you supply the full error (the full error is on the Output
page or on the command line). The full error is:

---8<---
error C2440: 'return' : cannot convert from '__const_Char_ptr' to
'wchar_t __gc *'
Conversion loses qualifiers
--->8---

The problem is that __const_Char_ptr has a const qualifier, while the
declared return type of the function is non-const. You need to add
'const':

---8<---
const wchar_t __gc* GetAssemblyPath()
{
return PtrToStringChars(Assembly::GetExecutingAssembly()->Location);
}
--->8---

Or alternatively, use const_cast<> to cast it away.

-- Barry

--
AddThis Social Bookmark Button