I am trying to use a existing c code in Windows Phone. For that I have created a Windows phone runtime component (C++) which has the legacy c code and referring it in my managed WP8 application.
I am facing issues in building the solution.

I have disable Precompiled headers option for "sample.c"
sample.h
int getNumber();
sample.c
#include <stdio.h>
#include"sample.h"
int main()
{
    printf("This is a native C program.\n");
    return 0;
}
int getNumber()
{
    return 2014; // Sample value to return 
}
NativeComponentRoot.cpp
#include "pch.h"
#include "NativeComponentRoot.h"
#include "sample.h" 
using namespace NativeComponentRoot;
using namespace Platform;
WindowsPhoneRuntimeComponent::WindowsPhoneRuntimeComponent()
{
}
NumberGenerator::NumberGenerator()
{
}
int NumberGenerator::GetMeANumber()
{
    int number = getNumber(); // Trying to invoke the function in sample.c
    return number;
}
Issue

I couldnt find a proper walk through for integrating "C" (Not C++) lib/code in Windows Phone Runtime and using it in managed project.
