locked
What is the best parttern for using Libs in a metro project

    Question

  • Hi, I have a project with a lot of code written in c++ like sqlite, boosts, ou core functions and others. Each of these projects we have placed in Visual Studio Projects, as lib projects.

    We have brought these projects for using in our metro application, but upon linking a lot of errors happen (lkn2005) saying we are defining things already defined.

    This has been very painful but no solution has been found.

     

    Can someone help me out on this suggesting the best way for working with libs?

     

    Thank you.

     

    Wednesday, October 12, 2011 5:44 PM

Answers

  • How exactly are you using sqlite binaries?  Are you packaging them along with your app?  Did you build them using VS Express or did you use existing binaries?
    • Marked as answer by ClaudioMSJr Monday, October 17, 2011 5:38 PM
    Wednesday, October 12, 2011 11:18 PM

All replies

  • Hi, I have a project with a lot of code written in c++ like sqlite, boosts, ou core functions and others. Each of these projects we have placed in Visual Studio Projects, as lib projects.
     
    We have brought these projects for using in our metro application, but upon linking a lot of errors happen (lkn2005) saying we are defining things already defined.
     
    This has been very painful but no solution has been found.
     
    Can someone help me out on this suggesting the best way for working with libs?
    Do all your projects have the same CRT settngs?
     
    I believe WinRT projects should always use dynamic linking (/MD, /MDd).
     

    David Wilkinson | Visual C++ MVP
    Wednesday, October 12, 2011 6:24 PM
  • Thank you so much. It worked out.

    But I still have some problem. My sqlite project stoped, I believe it uses some APIs broken by the sandbox of the AppX.

     

    Some suggestion?

     

    Thank you.

    Wednesday, October 12, 2011 8:00 PM
  • Thank you so much. It worked out.
     
    But I still have some problem. My sqlite project stoped, I believe it uses some APIs broken by the sandbox of the AppX.
    Very possibly. Perhaps somebody else can help you with that.
     

    David Wilkinson | Visual C++ MVP
    Wednesday, October 12, 2011 8:44 PM
  • How exactly are you using sqlite binaries?  Are you packaging them along with your app?  Did you build them using VS Express or did you use existing binaries?
    • Marked as answer by ClaudioMSJr Monday, October 17, 2011 5:38 PM
    Wednesday, October 12, 2011 11:18 PM
  • As for sqlite, you could use this wrapper: http://sqlwinrt.codeplex.com/

    You'll need sqlite.h and sqlite.c. While sqlite uses unsupported APIs it's easy to modify the code so it passes certification (e.g. using CreateFile2 instead of CreateFileW).

    Saturday, October 15, 2011 10:41 AM
  • Hi, I have made that to some of my libs. CreateFile2 is very simple in this transition.

    Why can't I create files in the Documents Folder using CreateFile2? I have to save my db and logs on Windows::Storage::ApplicationData path provided for local state.

     

    Other question: Can I take advantage of the roaming feature using CreateFile2 and the Roaming path provided by ApplicationData, without using WinRT components?

     

    Thank you.

    Monday, October 17, 2011 5:37 PM