Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on C++ Window store application where I need a dll.

#pragma once

using namespace Windows::Foundation;

namespace MyText
{
    public ref class Class1 sealed
    {
    public:
        Class1();
	int Add(int x, int y);
    };
}


If I remove Add function then there is NO error. I am unable to understand why?
Posted
Comments
[no name] 19-Dec-13 2:13am    
Where is Add defined? Have you read the msdn documentation for lnk2019?
AghaKhan 19-Dec-13 2:13am    
It is linker error. I am calling this class to my C++ Window Store Application
AghaKhan 19-Dec-13 2:16am    
Got it. Thanks for help. I didn't add in CPP file. :-(

if you only write it in the header it is the declaration. If you implement it in the cpp file not only your linker will be happy ;-)
 
Share this answer
 
Comments
CPallini 20-Dec-13 11:22am    
5.
Change from
Quote:
int Add(int x, int y);
to
C++
int Add(int x, int y){return (x+y);}
And the compiler will bless you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900