这是我的问题警告(etoa:4549):变量“T1”在设置值之前被使用
当我运行它时,调试器
打开!
我不知道出了什么问题,我无法运行它!
CPU: Windows 6.1. Processor #0. Memory Size: 0x1f00000 (31Mb). BSP version 6.9/0. Created: Jul 17 2012, 10:12:44 ED&R Policy Mode: Deployed WDB Comm Type: 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!
最佳答案
您有一个变量 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, ...);
关于c - vxWorks 警告 : variable <task> is used before its value is set,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34362625/