реклама на сайте
подробности

 
 
> C,WinAvr, указатель на функцию(+)
Qwertty
сообщение Apr 12 2008, 21:31
Сообщение #1


Местный
***

Группа: Свой
Сообщений: 408
Регистрация: 21-10-06
Из: Санкт-Петербург
Пользователь №: 21 527



Что то не выходит цветок каменный sad.gif

Код
// test.h
#ifndef    _TEST_H_
#define    _TEST_H_

#include    <inttypes.h>

enum    enButtons { btNone, btUp, btDown, btLeft, btRight, btEnter, btExit };
typedef void (*DispFuncPtr)(enum enButtons btn);

extern    DispFuncPtr*    DispFunc;

extern    void TestFunc1(enum enButtons btn);
extern    void TestFunc2(enum enButtons btn);

#endif


Код
//test.c
#include    "test.h"

DispFuncPtr*    DispFunc = (void*)0;

void TestFunc1(enum enButtons _btn)
{

}

void TestFunc2(enum enButtons _btn)
{

}

Код
//main.c
#include    <inttypes.h>
#include    "test.h"


int    main(void)
{
enum    enButtons x;
DispFunc = (DispFuncPtr*)&TestFunc1;

x = btUp;
(*DispFunc)(x);

while(1){};
}

Результат:
Код
Build started 13.4.2008 at 01:31:32
avr-gcc.exe  -mmcu=atmega8 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=4000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT test.o -MF dep/test.o.d  -c  ../test.c
avr-gcc.exe  -mmcu=atmega8 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=4000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT main.o -MF dep/main.o.d  -c  ../main.c
C:\DOCUME~1\Pawel\LOCALS~1\Temp/ccKMaaaa.s: Assembler messages:
C:\DOCUME~1\Pawel\LOCALS~1\Temp/ccKMaaaa.s:35: Error: garbage at end of line
C:\DOCUME~1\Pawel\LOCALS~1\Temp/ccKMaaaa.s:36: Error: missing ')'
C:\DOCUME~1\Pawel\LOCALS~1\Temp/ccKMaaaa.s:36: Error: garbage at end of line
make: *** [main.o] Error 1
Build succeeded with 0 Warnings...

Раньше что то типа этого проходило. Что у меня не так?
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 9th August 2025 - 12:58
Рейтинг@Mail.ru


Страница сгенерированна за 0.01381 секунд с 7
ELECTRONIX ©2004-2016