vico
vico

Reputation: 18175

Can't add function to MFC ActiveX

I' trying to create ActiveX component mfc_activeX using Visual Studio 2010 c++ MFC library. After finishing wizard system compiles without errors.

After adding simple new method by clicking right mouse on Cmfc_activeXCtrl Add>>Add Function and filling in/out params form I got simple function:

int Cmfc_activeXCtrl::Hello(int i)
 {
 return 0;
 }

After this procedure I can't compile code anymore. I have messages:

Error   85  error MSB8011: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions.   C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets   744 6   mfc_activeX


86  IntelliSense: #error directive: Please use the /MD switch for _AFXDLL builds    c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxver_.h 81  3   

How to escape from these errors?

Upvotes: 0

Views: 1121

Answers (1)

PeskyGnat
PeskyGnat

Reputation: 2464

Visual Studio is running with a user that does not have permission to run regsvr32, which attempts to register the component after a successful build.

You can get around this by running Visual Studio as Administrator.

As for the 2nd error

#error Please use the /MD switch for _AFXDLL builds

Actually, I had to switch to another /Mx setting, and then switch back so the selection was in bold, it seems the IDE isn't updating properly.

Upvotes: 1

Related Questions