unresolved external symbol "public: virtual class Platform::String ^ RRS feed

  • Question

  • I'm venturing into C++ to create WinRT Component DLL. It has been some time since I used C++, so please be gentle.

    I'm trying to create a method that returns a String that I can use in my C# app. I'm getting the error:

    unresolved external symbol "public: virtual class Platform::String ^ ...

    I tried including vcorlib.h thinking that's where Platfom::String lives, but that just made things worse.

    Here is my code:


    #pragma once namespace MyTest { public ref class Test sealed { public: Test(); Platform::String^ Hello(); }; }


    #include "pch.h"
    #include "Test.h"
    using namespace MyTest;
    using namespace Platform;
    String^ Hello()
    	String^ str = "hello"; 
    	return str;

    • Edited by Richard Garside Thursday, April 12, 2012 6:27 AM Indication that error message was longer
    Wednesday, April 11, 2012 11:56 AM


  • Hello,

    The Hello function should be in the Test class. When you implement it, you should add the class name like

    String^ Test::Hello()
    	String^ str = "hello"; 
    	return str;

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, April 12, 2012 5:08 AM