首页 > 数据库 >rust call sqlite3 error: linking with `link.exe` failed: exit code: 1181

rust call sqlite3 error: linking with `link.exe` failed: exit code: 1181

时间:2023-12-26 23:00:14浏览次数:37  
标签:code name demo linking person exe error data id

rust call sqlite3 error: linking with link.exe failed: exit code: 1181

声明:本文禁止csdn.net及所有所有子网站转载。禁止以营利性为目的的转载。

报错

error: linking with `link.exe` failed: exit code: 1181                                                                              
  |
  = note: ...
  ....
  = note: LINK : fatal error LNK1181: 无法打开输入文件“sqlite3.lib”


warning: `demo` (bin "demo") generated 1 warning                                                                                    
error: could not compile `demo` (bin "demo") due to previous error; 1 warning emitted

Cargo.toml

[package]
name = "demo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rusqlite = { version = "0.30.0", features = ["winsqlite3"] }

src/main.rs

use rusqlite::{Connection, Result};

#[derive(Debug)]
struct Person {
    id: i32,
    name: String,
    data: Option<Vec<u8>>,
}

fn main() -> Result<()> {
    let conn = Connection::open("person.db")?;

    conn.execute(
        "CREATE TABLE person (
            id    INTEGER PRIMARY KEY,
            name  TEXT NOT NULL,
            data  BLOB
        )",
        (), // empty list of parameters.
    )?;
    let me = Person {
        id: 0,
        name: "Roc".to_string(),
        data: None,
    };
    conn.execute(
        "INSERT INTO person (name, data) VALUES (?1, ?2)",
        (&me.name, &me.data),
    )?;

    let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
    let person_iter = stmt.query_map([], |row| {
        Ok(Person {
            id: row.get(0)?,
            name: row.get(1)?,
            data: row.get(2)?,
        })
    })?;

    for person in person_iter {
        println!("Found person {:?}", person.unwrap());
    }
    Ok(())
}

通过添加winsqlite3特性来解决:

cargo add rusqlite --features winsqlite3

标签:code,name,demo,linking,person,exe,error,data,id
From: https://www.cnblogs.com/linga/p/17929571.html

相关文章

  • codeforces刷题(1100):1904B_div2
    B、CollectingGame跳转原题点击此:该题地址1、题目大意  获得一个由n位正整数组成的数组。你可以选择选择任意一个数作为你的判断值。然后任意一个\(\le\)它的数可以被选中加入你的分数(注意判断值不算在里面),同时该数被移除数组。你的任务是,对于该数组中的每个数,都将其作为......
  • codeforces刷题(1100):1905B_div2
    B、Begginer'sZelda跳转原题点击此:此题地址1、题目大意  给你一个子树,你可任意选择两个节点\(u、v\),这两个节点之间的所有节点(包括\(u、v\))都将结合变为一个新的节点。要求你通过该操作将所有的节点变为只有一个节点,求最小的操作数。2、题目解析  由题意可得:当\(u、v\)......
  • CodeForces 1917E Construct Matrix
    洛谷传送门CF传送门\(2\nmidk\)显然无解。若\(4\midk\),发现给一个全\(2\times2\)子矩形全部异或\(1\)不会对行异或和和列异或和造成影响。那么我们找到\(\frac{k}{4}\)个全\(0\)的\(2\times2\)子矩形填\(1\)即可。否则若\(k=2\)或\(k=n^2-2\)......
  • CodeForces 1917F Construct Tree
    洛谷传送门CF传送门考虑形式化地描述这个问题。先把\(l\)排序。然后相当于是否存在一个\(\{1,2,\ldots,n\}\)的子集\(S\),使得:\(\sum\limits_{i\inS}l_i=d\)。\(\existsT\subseteqS,\max\limits_{i\notinS}l_i\le\min(\sum\limits_{i\inT}l_i,\sum......
  • html jquery from 表单提交 application/x-www-form-urlencoded 改成 json
    htmljqueryfrom表单提交$(form).ajaxSubmitapplication/x-www-form-urlencoded改成json<formclass="formform-horizontal"id="form-admin-add"><divclass="rowcl"><labelclass="form-labelcol-xs-4col-......
  • 汉字在unicode的编码情况-From http://yedict.com/zsts.htm
    字符集内容字数unicode编码字符显示说明(除非安装更大字库)基本区 分页:  一 二 三 四共20902字4E00-9FA5电脑和手机都能显示基本区补充共90字9FA6-9FFF电脑或安卓5以上的手机能显示一部分扩展A共6582字3400-4DB5电脑和手机都能显示扩展A补充共10......
  • AtCoder_abc334
    AtCoder_abc334A-ChristmasPresent题目描述输入两个数\(B,G(B\neqG)\),若\(B\)大,输出Bat,否则输出Glove。解题思路无Code//Problem:A-ChristmasPresent//Contest:AtCoder-UNIQUEVISIONProgrammingContest2023Christmas(AtCoderBeginnerContes......
  • Codeforces Round 915 (div2) E
    E.TreeQueries[题目链接](https://codeforces.com/contest/1904/problem/EProblem-E-Codeforces)题意概括:给定一棵大小为\(n\)的树,回答如下询问,询问之间相互独立:给定一个点\(x\)与\(k\)个点\(a_i\),求出从\(x\)出发不经过任何一个\(a_i\)的最长简单路径长度......
  • codeforces刷题(1100):1917B_div2
    模板B、EraseFirstorSecondLetter跳转原题点击此:该题地址1、题目大意  给你一个字符串,可以执行任意次以下操作,生成最终的字符串(不可为空),问你能生成的不重复字符串数为多少。操作一:删除字符串第一个字符;操作二:删除字符串第二个字符。2、题目解析  发现,操作一:即选......
  • leetcode 1633. 各赛事的用户注册率
    https://leetcode.cn/problems/percentage-of-users-attended-a-contest/?envType=study-plan-v2&envId=sql-free-50聚合函数分组后计算的是一组内的数据,分组前我们认为所有数据是一组本题注意还需要嵌套语句selectcontest_id,round(count(user_id)/(selectcoun......