这是我的问题warning (etoa:4549): variable "T1" is used before its value is set
当我运行此debugger
开启时!
我不知道错了什么,我不能这样做!
CPU:Windows 6.1。处理器#0。内存大小:0x1f00000(31Mb)。 BSP 版本6.9 / 0。创建时间:2012年7月17日,10:12:44 ED& R政策模式: 部署的WDB Comm类型:WDB_COMM_PIPE WDB:Ready。
-> Exception !
Vector 13 : Access Violation
Program Counter: 0x00000000
Access Address (read): 0x00000000
Status Register: 0x00010246
Task: 0x1044e2d0 "T3"
0x1044e2d0 (T3): task 0x1044e2d0 has had a failure and has been stopped.
0x1044e2d0 (T3): fatal kernel task-level exception!
Exception !
Vector 13 : Access Violation
Program Counter: 0x00000000
Access Address (read): 0x00000000
Status Register: 0x00010246
Task: 0x1044dce0 "T1"
0x1044dce0 (T1): task 0x1044dce0 has had a failure and has been stopped.
0x1044dce0 (T1): fatal kernel task-level exception!
Exception !
Vector 13 : Access Violation
Program Counter: 0x00000000
Access Address (read): 0x00000000
Status Register: 0x00010246
Task: 0x1044dfd8 "T2"
0x1044dfd8 (T2): task 0x1044dfd8 has had a failure and has been stopped.
0x1044dfd8 (T2): fatal kernel task-level exception!
答案 0 :(得分:2)
您有一个变量int task_1
以及一个名为void task_1(void)
的函数。因此,当您打算将函数指针作为参数传递给taskSpawn
时,实际上您正在传入int变量task_1
。这会导致警告您在分配之前使用task_1
。
您应该更改其中一项的名称,以便不存在冲突。
int task_id_1, task_id_2, task_id_3, msgQueueId;
task_id_1 = taskSpawn(..., (FUNCPTR)task_1, ...);