locked
C++/CX Problem

    General discussion

  • Hi there,

    i'm a newbie in C++ and now i'm at a point i can't solve the Problem. Last day i changed from VS 2012 Beta to the RC and now I have the Problem, that i'm not able to compile my Project.

    I get an error in the following code (only the interesting snippet) when i try to compile the Project:

    #pragma once

    #include "DirectXBase.h"

    ...

    #include "InputController.h"

    namespace xyz{

    ref class Manager sealed : public DirectXBase

    {

    public:

    Manager();

    ...

    private:

    InputController^ m_pInputController;

    boolean m_showInfo;

    ...

    };

    }

    the class InputController is defined like this:

    namespace xyz {

    ref class InputController sealed

    {

    public:

    InputController();

    ...

    private:

    ...

    };

    }

    The compiler has a problem with this line of code:

    InputController^   m_pInputController;

    1> c:\users\...\manager.h(47): error C2143: Syntax error: Missing ';' before '^' (InputController.cpp)

    1> c:\users\...\manager.h(47): error C4430: Missing type spezifier - int assumed. Note: C++ does not support default-int (InputController.cpp)

    1> c:\users\...\manager.h(47): error C3699: "^": This reference cannot be used for the type "int". (InputController.cpp)

    Unfortunately i don't know what to do :-(

     


    Saturday, June 2, 2012 4:43 PM

All replies

  • Try marking your constructor as internal, so instead of:

    public:
         InputController();

    try:

    internal:
         InputController();

    hope that helps

    http://www.puttnutz.com

    Sunday, June 3, 2012 7:15 AM
  • Unfortunately there's no change of the result :-(

    Get still the same Errors.

    Sunday, June 3, 2012 9:36 PM
  • There's not enough information here. What is line 47 of manager.h, for instance. The missing ';' error usually means you've got a syntax error upstream of that.

    I took a Consumer Preview Direct2DApplication, straight from the wizards and copied it to RC/RP. After making the public to internal changes and getting a clean build, I added your posted code.

    This I was able to get to build by adding a Render override:

    namespace xyz {
    	ref class InputController sealed	
    	{	
    	public:		
    		InputController();	
    	};
    }
    
    namespace xyz{
    	ref class Manager sealed : public DirectXBase {
    public:
    	Manager();
    	virtual void Render(void) override {};
    private:
    	InputController^	m_pInputController;	
    	boolean		m_showInfo;	
    };}
    If that's not it, can you put a full sample on skydrive, or email me the sample directly to shorne at microsoft dot com?
    Monday, June 4, 2012 11:34 PM
    Moderator
  • @Steve Horne: I added the override for Render before, but after comparing it to the standard sample i still don't now what's wrong. So i decided to share a sky drive folder with you. Hope you got the email.
    Tuesday, June 5, 2012 6:23 PM