nik-el 0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
||||
1 |
||||
04.06.2018, 17:24. Показов 3486. Ответов 15 Метки нет (Все метки)
Помогите разобраться где косяк
. . . .
__________________
0 |
Модератор 8759 / 6549 / 887 Регистрация: 14.02.2011 Сообщений: 22,972 |
|
05.06.2018, 06:36 |
2 |
смотри где определен макрос
0 |
nik-el 0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
||||||||
05.06.2018, 09:57 [ТС] |
3 |
|||||||
1. макрос _AVR_IOXXX_H_ поиском по всему проекту не обнаружен
— assembler.h —
Добавлено через 35 минут
0 |
Модератор 8759 / 6549 / 887 Регистрация: 14.02.2011 Сообщений: 22,972 |
|
05.06.2018, 10:58 |
4 |
в iotn1616.h (см. #1) кусок кода в первом сообщении оттуда?
0 |
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
05.06.2018, 11:37 [ТС] |
5 |
из самого начала файла iotn1616.h — это описание tiny1616
0 |
ValeryS Модератор 8759 / 6549 / 887 Регистрация: 14.02.2011 Сообщений: 22,972 |
||||
05.06.2018, 11:49 |
6 |
|||
из самого начала файла iotn1616.h тогда ищи где он включен 2 и более раз
если макрос _AVR_IOXXX_H_ не определен то определить его как «iotn1616.h» Попытка включить более одного файла <avr / ioXXX.h>
1 |
nik-el 0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
||||||||||||
05.06.2018, 12:43 [ТС] |
7 |
|||||||||||
Спасибо, буду искать Добавлено через 1 минуту Добавлено через 5 минут
если макрос _AVR_IOXXX_H_ не определен то определить его как «iotn1616.h» а разве хедер м.б. макросом или это нюансы С ? Добавлено через 7 минут
Добавлено через 2 минуты Добавлено через 25 минут
Добавлено через 1 минуту
0 |
nik-el 0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
||||||||||||
07.06.2018, 14:13 [ТС] |
8 |
|||||||||||
файл iotn1616.h лежит не в проекте а в самой студии
а если что не так то:
Добавлено через 5 минут Добавлено через 4 часа 11 минут
0 |
ValeryS Модератор 8759 / 6549 / 887 Регистрация: 14.02.2011 Сообщений: 22,972 |
||||
07.06.2018, 14:19 |
9 |
|||
в самом начале main.c есть вот такое: попробуй вот это выбросить
0 |
nik-el 0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
||||||||
08.06.2018, 09:29 [ТС] |
10 |
|||||||
я конечно попробовал, хоть и сомневался что это правильно 1. multiple definition of `key_status’ Добавлено через 44 минуты
это бред какой то Добавлено через 17 часов 6 минут
этот код может как то не состыковаться с С++ в АтмелСтудии7 ?
0 |
ValeryS Модератор 8759 / 6549 / 887 Регистрация: 14.02.2011 Сообщений: 22,972 |
||||
08.06.2018, 09:41 |
11 |
|||
за «основу» программы я взял пример из инета и весь состоит из макросов
без конкретного микропроцессора
0 |
nik-el 0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
||||
08.06.2018, 13:32 [ТС] |
12 |
|||
Спасибо, но я уже выбрал контроллер под конкретную задачу и через Атмел Старт настроил/создал проект, прогу, но Добавлено через 19 минут
Добавлено через 23 минуты
0 |
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
18.06.2018, 11:39 [ТС] |
13 |
к «регулярно запинаюсь из-за разных подходов(в примерах) в программировании на С / С++ и для разных сред»
0 |
Arhat109 -28 / 20 / 2 Регистрация: 18.06.2018 Сообщений: 199 |
||||
20.06.2018, 12:36 |
14 |
|||
Не знаю как там в Атмел студии, но вообще-то хидеры, определяющие микроконтроллер напрямую в main не включаются, а подключаются автоматом через общий хидер io.h. Тип микроконтроллера надо указывать не подключаемым хидером, а символом #define соответственно типу кристалла, типа так:
Скорее всего, достаточно писать короче, только include. а символ с меткой кристалла укажет сама Студия, где наверняка есть в проекте «тип камня», который надо вырать для настройки проекта .. хотя тут — не знаю, не работал с ней.
0 |
0 / 0 / 0 Регистрация: 04.06.2018 Сообщений: 16 |
|
03.07.2018, 16:36 [ТС] |
15 |
«тип камня» и многое др. задаются в AtmelStart
bool GET_MUTLCAP_SENSOR_NOISE_STATUS(uint8_t SENSOR_NUMBER) ругается так:
0 |
0 / 0 / 0 Регистрация: 23.02.2016 Сообщений: 4 |
|
05.04.2022, 21:17 |
16 |
я сначала не понял почему ругалось на Потом понял, я ж в свойствах проекта задал Device, поэтому автоматом подгрузилась соответствующая библиотека (в свойствах проекта в разделе Packs это видно в Header), а я в main.c ее второй раз как бы подключаю, поэтому макрос _AVR_IOXXX_H_ уже определен и вылезает ошибка
0 |
Prototype function definition
Hi, i am using a tool developed in C and i use «make all» command to run. But the following error occur:
cc -O -DUNIX -DBSD -g -I/home/English/morph-1.5/hash -I/usr/include/X11/Xaw -c -w -o lib/bcopy.o /home/English/morph-1.5/hash/bcopy.c
/home/English/morph-1.5/hash/bcopy.c: In function �bcopy�:
/usr/include/bits/string3.h:90: error: old-style parameter declarations in prototyped function definition
make: *** [lib/bcopy.o] Error 1and the program is given below
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = «@(#)bcopy.c 5.7 (Berkeley) 5/16/90»;
#endif /* LIBC_SCCS and not lint */#include <string.h>
#include <sys/types.h>/*
* sizeof(word) MUST BE A POWER OF TWO
* SO THAT wmask BELOW IS ALL ONES
*/
typedef int word; /* «word» used for optimal copy speed */#define wsize sizeof(word)
#define wmask (wsize — 1)/*
* Copy a block of memory, handling overlap.
* This is the routine that actually implements
* (the portable versions of) bcopy, memcpy, and memmove.
*/
void bcopy(const void *src0, void *dst0, size_t length)
//void bcopy( src0, dst0, length)
char *dst0;
char *src0;
register size_t length;
{
register char *dst = dst0;
register char *src = src0;
register size_t t;if (length == 0 || dst == src) /* nothing to do */
return;/*
* Macros: loop-t-times; and loop-t-times, t>0
*/
#define TLOOP(s) if (t) TLOOP1(s)
#define TLOOP1(s) do { s; } while (—t)if ((unsigned long)dst < (unsigned long)src) {
/*
* Copy forward.
*/
t = (int)src; /* only need low bits */
if ((t | (int)dst) & wmask) {
/*
* Try to align operands. This cannot be done
* unless the low bits match.
*/
if ((t ^ (int)dst) & wmask || length < wsize)
t = length;
else
t = wsize — (t & wmask);
length -= t;
TLOOP1(*dst++ = *src++);
}
/*
* Copy whole words, then mop up any trailing bytes.
*/
t = length / wsize;
TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize);
t = length & wmask;
TLOOP(*dst++ = *src++);
} else {
/*
* Copy backwards. Otherwise essentially the same.
* Alignment works as before, except that it takes
* (t&wmask) bytes to align, not wsize-(t&wmask).
*/
src += length;
dst += length;
t = (int)src;
if ((t | (int)dst) & wmask) {
if ((t ^ (int)dst) & wmask || length <= wsize)
t = length;
else
t &= wmask;
length -= t;
TLOOP1(*—dst = *—src);
}
t = length / wsize;
TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src);
t = length & wmask;
TLOOP(*—dst = *—src);
}
return;
}
Re: Prototype function definition
Moved to «Programming Talk»
Re: Prototype function definition
Originally Posted by grk.jkb
Hi, i am using a tool developed in C and i use «make all» command to run. But the following error occur:
cc -O -DUNIX -DBSD -g -I/home/English/morph-1.5/hash -I/usr/include/X11/Xaw -c -w -o lib/bcopy.o /home/English/morph-1.5/hash/bcopy.c
/home/English/morph-1.5/hash/bcopy.c: In function �bcopy�:
/usr/include/bits/string3.h:90: error: old-style parameter declarations in prototyped function definition
make: *** [lib/bcopy.o] Error 1Code:
void bcopy(const void *src0, void *dst0, size_t length) //void bcopy( src0, dst0, length) char *dst0; char *src0; register size_t length; {That’s were the error is occuring, like the message said, old-style (pre-ANSI) parameter declarations mixed with prototyped (ANSI) function definition.
Two quick solutions here: either remove the prototyped definition and uncomment the old-style definition:Code:
//void bcopy(const void *src0, void *dst0, size_t length) void bcopy( src0, dst0, length) char *dst0; char *src0; register size_t length; {or use the new-style prototyped function defintion:
Code:
void bcopy(const void *src0, void *dst0, size_t length) /* void bcopy( src0, dst0, length) char *dst0; char *src0; register size_t length; */ {I would go for the prototyped function definition, unless you need portability to old systems without an ANSI/ISO-C compliant compiler.
Another way is this:
Code:
#ifdef __STDC__ void bcopy(const void *src0, void *dst0, size_t length) #else void bcopy( src0, dst0, length) char *dst0; char *src0; register size_t length; #endif {This will pick the prototyped version for ANSI/ISO-C compliant compilers and the old definition syntax for pre-ANSI/ISO compilers.
Additional nitpick: C++-style comments (//) are accepted in C99 and GNU-C, but illegal in C90, so if you want maximum portability you should avoid those.
Hope this helps.
«When in doubt, use brute force.»
— Ken Thompson
-
#1
I’m unable to upgrade to the latest version of
lsof
.
Code:
ckkv.c:58: error: old-style parameter declarations in prototyped function definition
/usr/include/xlocale/_time.h:45: error: parameter name omitted
/usr/include/xlocale/_time.h:45: error: parameter name omitted
/usr/include/xlocale/_time.h:45: error: parameter name omitted
/usr/include/xlocale/_time.h:46: error: parameter name omitted
/usr/include/xlocale/_time.h:46: error: parameter name omitted
ckkv.c:61: error: storage size of 'u' isn't known
ckkv.c:63: error: 'Fwarn' undeclared (first use in this function)
ckkv.c:70: error: 'Pn' undeclared (first use in this function)
ckkv.c:73: error: 'er' undeclared (first use in this function)
ckkv.c:76: error: 'd' undeclared (first use in this function)
ckkv.c:78: error: 'ev' undeclared (first use in this function)
ckkv.c:83: error: 'ea' undeclared (first use in this function)
*** [ckkv.o] Error code 1
Stop in /usr/ports/sysutils/lsof/work/lsof_4.87/lsof_4.87_src/lib.
*** [lib/liblsof.a] Error code 1
Stop in /usr/ports/sysutils/lsof/work/lsof_4.87/lsof_4.87_src.
*** [do-build] Error code 1
Stop in /usr/ports/sysutils/lsof.
[8]root@test:/usr/ports/sysutils/lsof #
I’ve uninstalled and reinstalled to no avail. What am I doing wrong?
Running FreeBSD 9.0-STABLE #6.
~Doug
-
#2
dougs said:
Code:
ckkv.c:58: error: old-style parameter declarations in prototyped function definition
I portsnapped, fetched the source and had a look at this file. It does indeed contain a K&R-style function header which is pretty much antiquated by now. A quick fix would be to change it into the current function format: instead of
Code:
void
ckkv(d, er, ev, ea)
char *d;
char *er;
char *ev;
char *ea;
{
[i]...[/i]
}
make it
Code:
void
ckkv(char *d, char *er, char *ev, char *ea)
{
[i]...[/i]
}
Or alternatively, there’s probably a compiler option somewhere that tells gcc (assuming that’s the compiler you use) to accept old-style K&R function headers.
If you cannot program in C and/or there are several more of these old-style definitions, post the contents of
/etc/make.conf
if there’s anything in there. If not, I suggest you notify the port maintainer of the problem because in that case (s)he should probably update the port so that others don’t run into the same problem.
Hope this helps,
Fonz
-
#3
To followup: the port in question compiles just fine on the 8.2-RELEASE/amd64 system I’m on at the moment, so I strongly suspect there’s a compiler option issue somewhere in all of this.
Fonz
-
#4
Builds without errors or warnings on 9-STABLE amd64.
-
Thread Starter
-
#5
Code:
[11]root@test:/usr/ports/sysutils/lsof # less /etc/make.conf
WITHOUT_X11=yes
#
# Keep ruby 1.8 as default version.
#
RUBY_DEFAULT_VER=1.8
# added by use.perl 2012-03-09 14:05:39
PERL_VERSION=5.14.2
Can someone walk me through the compiler options? I’m not versed in compiling at all. I just follow what the handbook tells me in upgrading ports.
I’m on 9.0-STABLE x86.
~Doug
-
#6
It should just be
Code:
# cd /usr/ports/sysutils/lsof
# make install clean
It’s hard to tell what’s causing that error. If some odd compiler flags were set, they would usually be in
/etc/make.conf
. What customizations have you done to the system? 9.0-STABLE as of what date? Has the system been compiled since
/usr/src
was last updated?
-
#7
Also, is your ports tree up to date?
Fonz
-
Thread Starter
-
#8
Um, it’s possible that I may have run
svn
and then decided not to build world/kernel.
Code:
[14]root@test:/usr/src # svn info
Path: .
Working Copy Root Path: /usr/src
URL: http://svn0.us-west.freebsd.org/base/releng/9.0
Repository Root: http://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 243633
Node Kind: directory
Schedule: normal
Last Changed Author: simon
Last Changed Rev: 243417
Last Changed Date: 2012-11-22 14:52:15 -0800 (Thu, 22 Nov 2012)
[14]root@test:/usr/src #
This machine is one of two 9.0-STABLE machines here at work— the rest are 9.0-RELEASE.
I will do another
svn
and rebuild after this weekend. I’ll report how it turns out.
Oh, and yes, the ports are up-to-date. I run portsnap fetch/update once a week.
~Doug
-
#9
That is probably not the problem, but it’s good to make sure source and binary are the same.
-
Thread Starter
-
#10
So I ran
svn
and rebuilt world/kernel. Now I can install and execute
lsof
just fine. Egads.
~Doug
-
#11
If I remember rightly lsof actually uses files found in
/usr/src
during compilation. I suspect if these files are different to the actual files installed in the base system then there might be some conflict there. You suggest you svn’d without installing a new world/kernel so I guess that’s the case.
-
#12
Yes, I believe
lsof
requires the kernel source files to be in accordance with the actual kernel.