今天我决定学习并开始用 Rust 编码,因为它是一种非常有前途的语言。但是,我尝试在 rust 中编译并运行一个简单的 Hello world 程序,但由于某种原因出现此错误。有人能告诉我出了什么问题吗?
这是我的防锈代码:
fn main(){
println!("Hi");
}
Run Code Online (Sandbox Code Playgroud)
这是错误消息:
错误:与
cc
失败:退出代码:1 | = 注意:“cc”“-m64”“-L”“/Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib”“test.test. 7rcbfp3g-cgu.0.rcgu.o" "test.test.7rcbfp3g-cgu.1.rcgu.o" "test.test.7rcbfp3g-cgu.2.rcgu.o" "test.test.7rcbfp3g-cgu.3 .rcgu.o" "test.test.7rcbfp3g-cgu.4.rcgu.o" "test.test.7rcbfp3g-cgu.5.rcgu.o" "-o" "test" "test.5fi6c8ty3hqyycqf.rcgu.o " "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users /moo7md/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-a5984f6fc2a4870f.rlib"
我在另一个回收器视图中添加回收器视图时遇到问题。子回收器位于 CardView 内,而 CardView 位于父回收器视图内。我尝试了互联网上的所有解决方案,但没有用。我希望子回收器视图垂直滚动,而父回收器视图也垂直滚动。
父级回收者视图:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/backgroundPrimary"
tools:context=".BidsCenter">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bidCenter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
子回收器视图:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:animateLayoutChanges="true"
android:clickable="true"
android:elevation="3dp"
android:focusable="true"
android:orientation="vertical"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp">
<RelativeLayout
android:id="@+id/r0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/itemPreviewInCenter"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_margin="3dp"
android:scaleType="fitCenter"
android:src="@android:drawable/ic_menu_report_image" />
<TextView
android:id="@+id/itemTitleInCenter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="3dp"
android:layout_toStartOf="@+id/itemPreviewInCenter" />
<TextView
android:id="@+id/totalBidPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/numberOfBids"
android:background="@drawable/bid_total"
android:clickable="false" />
<TextView
android:id="@+id/latestBidDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud) 所以我试图创建一个表“Prerequisite_to”,它基本上是一个关系,显示哪些类被视为特定类的先决条件。这是我的 SQL 表缺陷:
CREATE TABLE Class(
infs CHAR(4) NOT NULL,
course_number CHAR(3) NOT NULL,
PRIMARY KEY (infs,course_number));
CREATE TABLE Prerequisite_to(
infs CHAR(4),
course_number CHAR(3),
PRIMARY KEY (infs,course_number),
FOREIGN KEY (infs) REFERENCES Class(infs),
FOREIGN KEY (course_number) REFERENCES Class(course_number)
)
Run Code Online (Sandbox Code Playgroud)
但是,当我执行脚本时,出现此错误:
17:29:43 CREATE TABLE Prerequisite_to(infs CHAR(4), course_number CHAR(3), PRIMARY KEY (infs,course_number), FOREIGN KEY (infs) REFERENCES Class(infs), FOREIGN KEY (course_number) REFERENCES Class(course_number) ) 错误代码:1822。无法添加外键约束。引用表 'Class' 中缺少约束 'prerequisite_to_ibfk_2' 的索引 0.00038 秒