none
[UWP][C++] How to set cqlite temp directory in uwp c++ winrt app RRS feed

  • Question

  • I've used vcpkg to install sqlite3:x64-uwp and sqlitecpp:x64-uwp and developed much of an app that makes use of a sqlite database file. However I ran into an issue on a group by. sqlite needs to be able to create temp files. I have been unable to set a directory for sqlite.

    if I try to set sqlite3_temp_directory before I load a db file as suggested here https://sqlite.org/c3ref/temp_directory.html I get the error

    unresolved external symbol sqlite3_temp_directory.

    How can i proceed to set the dqlite3 temp directory in a c++ winrt uwp app?
    Wednesday, November 6, 2019 11:12 PM

Answers

  • Hi,

    For this unresolved symbol error, it is caused by not importing the lib file. By testing, you can use the following methods to import the symbol sqlite3_temp_directory properly through the import LIB.

    #pragma comment(lib, "winsqlite3.lib")

    Or

    Right-click the project -> choose properties -> Linker -> Additional Dependencies -> add winsqlite3.lib in it.

    Best Regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    • Marked as answer by Camtar Friday, November 8, 2019 1:34 PM
    Friday, November 8, 2019 8:19 AM

All replies

  • Hi,

    When I tried to set sqlite3_temp_directory directly, I also received the same error and if I defined sqlite3_temp_directory as char*, it worked well. But it may not match what you expected. I researched about it, but did not find something useful. I'm not sure what caused this behavior. I'll need to ask team about this issue. There might be some time delay. 

    In addition, if the problem is specific to SQLite, you can also ask SQLite forums.

    Best Regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Thursday, November 7, 2019 8:06 AM
  • Thank you Fay. Yes I am still getting a sql logic error; that I must assume is coming from the temp directory not being set. It does not occur with the same code and same db in a non uwp app.
    Thursday, November 7, 2019 4:19 PM
  • Hi,

    For this unresolved symbol error, it is caused by not importing the lib file. By testing, you can use the following methods to import the symbol sqlite3_temp_directory properly through the import LIB.

    #pragma comment(lib, "winsqlite3.lib")

    Or

    Right-click the project -> choose properties -> Linker -> Additional Dependencies -> add winsqlite3.lib in it.

    Best Regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    • Marked as answer by Camtar Friday, November 8, 2019 1:34 PM
    Friday, November 8, 2019 8:19 AM
  • That worked! 
    Friday, November 8, 2019 1:35 PM