完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,请原谅我是NoOB。我有源码文件分析器。C,编译得很好。但是,我需要从Salc.c中调用一些函数。C,所以我添加了包括泛型。h到PARS.C。一旦这个头包含在一起,编译器就会抛出错误信息:/HOME/WALLME/MPLABXPROST/T。HeStudio/Posiv.H:20:38:错误之前:‘*’/Goo/Wale/MPLABX项目/项目/一般。h:22:28:错误:预期值''之前/home /Wale/MPLABX项目/项目/一般。h:30:40:错误:预期声明说明符或'Unt1616T'之前的……等等。我已经检查过了。对于不匹配的括号等代码,{{}[](),缺少分号等,但我找不到问题。一般.h文件也包含在其他C程序中,在那里不会引起问题。我应该如何查寻错误?谢谢你的建议!P.S.这是Linux上的MPLAB X 3.55,XC16 V1.31。该设备为PIC24FJ64 GA102
以上来自于百度翻译 以下为原文 Hi All, Please forgive me for being a noob. I have source file parser.c, which compiled fine. However, I need to call some functions in general.c from parser.c, so I added #include general.h to parser.c. As soon as this header is included the compiler throws error messages: /home/willem/MPLABXProjects/TheProject/general.h:20:38: error: expected ')' before '*' token /home/willem/MPLABXProjects/TheProject/general.h:22:28: error: expected ')' before 'value' /home/willem/MPLABXProjects/TheProject/general.h:30:40: error: expected declaration specifiers or '...' before 'uint16_t' and so on. I have checked the code over and over for unmatched parentheses and so on {} [] (), missing semicolons and so on, but I can't find the problem. The general.h file is also included in other .c programs, where it does not cause problems. How should I hunt down the error? Thanks for any suggestion! P.S. This is MPLAB X 3.55, XC16 v1.31 on Linux. The device is PIC24FJ64GA102 #ifndef GENERAL_H #define GENERAL_H #define BRIGHTNESS_STD 0x10 // Font constants for testing / setup #define XCHAR_L 1 // Test pattern left side #define XCHAR_R 2 // Test pattern right side // initialize panel (brightness) void PANEL_init(void); // matrix_write_text_16 is the mother function for displaying / scrolling text void matrix_write_text_16(TextObject *thetext); // buf_fill_8 quickly fills a buffer with value (byte) void mtx_buf_fill(uint16_t value); // setup puts a test pattern into the matrix void show_test_pattern(unsigned int delay); // show_logo puts the Display Promotions logo into the matrix void show_dp_logo(unsigned int delay); // string_length is our own implementation of strlen to avoid the string.h lib int string_length(char *s); // Copy 16 words of character data into txt_buf at position void font_cpy_2_txtbuf(char character, uint16_t font, uint16_t position); // Shiftl shifts text 1 bit left void shiftl(uint16_t line); // Copy 16 words of font data into scratch_buf2 void font_cpy_2_scratch2(char character, uint16_t font); // matrix_putchar_16 puts character data (font) at position into mtx_buf void matrix_putchar_imm_16(uint8_t character, uint16_t font, uint8_t position); /*--------------------------------------* * ASSEMBLY ROUTINES * *--------------------------------------*/ // mtx_map_16 takes care of mapping 16 words of data from txt_buf to mtx_buf // specific for P10 display type void _mtx_map_16(uint16_t *dst_buf, uint16_t *src_buf, uint16_t numpanel, uint16_t charpos); // fast_fill_16 puts n values (word) into destination, something like memset void _fast_fill_16(uint16_t *dst_buf, uint16_t value, uint16_t count); // get_font_offset returns the offset for the font (32 for ASCII) // so that character 'A' maps properly to the fontdata for 'A' uint8_t _get_font_offset(uint8_t font); // fast_copy_16 copies n words from source to destination, something like memcpy void _fast_copy_16(uint16_t *dst_buf, const uint16_t *src_buf, uint16_t count); // get_font_ptr_16 returns the base address of fontdata uint16_t *_get_font_ptr_16(uint8_t charnum, uint16_t fontnum); // Shift text 1 bit left void _txt_shiftl(uint16_t *outbuf, uint16_t *dstbuf, uint16_t *inpbuf, uint16_t numchar, uint16_t nextword); #endif // GENERAL_H #include #include #include #include "general.h" #include "global_define.h" #include "parser.h" #include "rowscanner.h" #include "eeprom_25lc1024.h" #include "mcc_generated_files/mcc.h" #include "mcc_generated_files/uart1.h" #include "main.h" #define MARKER "\%" uint8_t text_processor(char *ptr) { int length, i; char *localstr, *localptr, *endptr, *nextptr; char *l_buffer; } |
|
相关推荐
9个回答
|
|
对不起,哪20, 22行和30行?通常,当使用未定义的类型时,错误会弹出…例如UTI1616T(例如)
以上来自于百度翻译 以下为原文 Sorry, which are lines 20, 22 and 30? Usually that error pops out when an undefined type is used... such as uint16_t (for example) |
|
|
|
TestToBube声明在哪里?我怀疑你还需要一些其他的东西,包括一般的.H,或者嵌套的,一般的.H,来拉它所需要的。有很多关于如何构造包含文件的在线文章。
以上来自于百度翻译 以下为原文 Where is textObject declared? I suspect you need some other includes before including general.h, or nested includes in general.h, to pull in what it requires. There are plenty of online articles about how to structure include files. |
|
|
|
@ CiZigaGrand 20, 22和30是:空格MatrxWrthErthEngult16(TexToStux*TeTeXT);空白MTXBUFFYSULL(UTI1616T值);VultFuntCyPy22TXTBUF(字符字符,UTI1616T字体,UIT1616 T位置);@ Coprand TestToBube来自另一个头(GualalLyDealth.h):谢谢你们的快速回复。我需要深入挖掘以更好地理解页眉。
以上来自于百度翻译 以下为原文 @CinziaG Lines 20, 22 and 30 are these: void matrix_write_text_16(TextObject *thetext); void mtx_buf_fill(uint16_t value); void font_cpy_2_txtbuf(char character, uint16_t font, uint16_t position); @Crosland textObject comes from another header (global_define.h): typedef struct { char text[240]; // Text to display unsigned char line; // Which line to display unsigned char font; // Font to use unsigned char center; // Static text: Should it be centered (0-1) unsigned char clear; // Scroll text: Should previous be cleared (0-1) unsigned int delay; // Wait time until next text is processed unsigned char scrollspeed; // Scroll speed (0-32) unsigned char brightness; // Brightness to use (0-90) } TextObject; Thank you both for your quick replies. I guess I need to dig in deeper to get a better understanding about headers. |
|
|
|
伟大的!您指的是由稍后包含的标题定义的TestBoTube?你期待什么?匹配您的包含序列与序列联合其他项目“工作”和…嘿!
以上来自于百度翻译 以下为原文 Great! You are referring TextObject which is defined by a header that is included later? What do you expect? Match your include sequence with the sequence un the other projects where 'it works' and ... Hey presto! |
|
|
|
是的,我猜TestToStube是第一个问题,其他的则是…
以上来自于百度翻译 以下为原文 Yep, I suppose TextObject is the issue The first one, other follow that... |
|
|
|
没错,当编译器试图解析通用.h时,还没有包含它。
以上来自于百度翻译 以下为原文 Exactly. It hasn't yet been included when the compiler tries to parse general.h |
|
|
|
然后一般。H必须包含在它的主体之前。什么是包括STRNET.H还需要包括在内。
以上来自于百度翻译 以下为原文 Then general.h has to be included before it in main. And what whatever is including stdint.h needs to be included first also. |
|
|
|
每个人,谢谢你分享你的想法:-“将军.H”走错了地方,因为我到处摆弄所有的东西,试图去解决问题。当一般的.H和GualalyOrth.h定义为正确的顺序时,这个问题仍然存在(因此,一般H)知道“关于TextObject结构”。我开始认为问题来自于这个结构。我不得不摆弄“TyPulf”和“Stand”来让它在一开始就起作用。我将在结构上做更多的阅读(我对C编程很陌生)。
以上来自于百度翻译 以下为原文 Everyone, thank you for sharing your ideas :-) The "general.h" went into the wrong place, because I fiddled around with all the includes, trying to hunt down the problem. The problem persists also when general.h and global_define.h are in the right order (so that general.h "knows" about the TextObject structure). I'm beginning to think that the problem comes from this structure. I had to fiddle around with "typedef" and "structure" to make it work in the beginning. I'm going to do more reading on structures (I'm pretty new to C programming). |
|
|
|
NKurzman,你把它钉死了…St..h头在解析器中丢失了。C!另一个教训;-谢谢!
以上来自于百度翻译 以下为原文 NKurzman, you nailed it... The stdint.h header was missing in parser.c! Another lesson learned ;-) Thanks! |
|
|
|
只有小组成员才能发言,加入小组>>
5321 浏览 9 评论
2076 浏览 8 评论
1982 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3254 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2293 浏览 5 评论
835浏览 1评论
730浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
674浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
728浏览 0评论
622浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-2 19:28 , Processed in 1.213547 second(s), Total 94, Slave 77 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号