Re: Importing a type library into unmanaged code with /clr switch - linker errors

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance





Hi,

The best practise with /clr is to only define it for individual files. No
for whole projects. This can lead to a multitude of problems.
You also should not use #pragma unmanaged. source files should be wholly
compiled either managed or unmanaged, but not mixed. Doing so can lead to
CRT initialization problems.

Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
bruno_nos_pam_van_doo...@xxxxxxxxxxx

Thanks,

I made some progress by just enabling /clr on the module (cpp file)
only, but when I add managed code into the header file like:

#include <afxwinforms.h>

using namespace System;
using namespace System::Windows::Forms;

I get the compiler error:

3>C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include
\afxwinforms.h(19) : fatal error C1189: #error : MFC WinForms support
requires /clr (doesn't support oldSyntax)

How do I enable /clr for the header as well as the cpp without
applying it to the whole project?

Many thanks,

Duncan


.



Relevant Pages

  • Common Environment Object Model: getting the path to the cpp file a certain class is implemented in
    ... Say we have a CodeClass object and call AddFunction() on it. ... the call will end up with the function declaration ... in the header file for that class and the implementation in the cpp file. ...
    (microsoft.public.vsnet.general)
  • Re: Novice - Advice required
    ... > a seperate .cpp file (or header file?) and then whenever I want to ... int XYX::doTask ...
    (microsoft.public.vc.language)
  • Re: C++ header file
    ... Why not just have 1 CPP file and include the CPP file instead of ... In Java, there is no header file, each object is .java file. ... Separation of declaration and definition is very practical thing. ... It is sufficient to see only function's declaration in order to successfully compile a code that calls it. ...
    (microsoft.public.vc.language)
  • Re: call c++ function from c
    ... header file from the cpp file. ... In the header file the function is ... that lie to get a job, then dog it for as long as they can with a constant ... actually ever writing any type of useful software. ...
    (comp.lang.c)
  • Re: Linking + Emulation issues
    ... it is a header file. ... would see a compiler error. ... beitman AT applieddata DOT net ... Microsoft WEP Gold-level Member ...
    (microsoft.public.windowsce.embedded)