在FATFS例程上加入了自己的图像处理算法,因为算法是C++写的,所有将所有例程中的源文件也改为C++。源文件中所有printf都注释掉,编译是报错:
..SYSTEMusartusart.cpp(33): warning: #2681-D: name linkage conflicts with previous declaration of variable "std::__stdout" (declared at line 138 of "C:Keil_v5ARMARMCCBin..includestdio.h")
FILE __stdout;
..SYSTEMusartusart.cpp(33): error: #70: incomplete type is not allowed
FILE __stdout;
..SYSTEMusartusart.cpp(40): error: #734: function "fputc(int, std::FILE *)" conflicts with using-declaration of function "std::fputc(int, std::FILE *) C"
int fputc(int ch, FILE *f)
麻烦各位大神指点一下
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
//////////////////////////////////////////////////////////////////
//¼óèëòÔÏÂ′úÂë,Ö§3Öprintfoˉêy,¶ø2»DèòaÑ¡Ôñuse MicroLIB
#if 1
#pragma import(__use_no_semihosting)
//±ê×¼¿aDèòaμÄÖ§3Öoˉêy
struct __FILE
{
int handle;
/* Whatever you require here. If the only file you are using is */
/* standard output using printf() for debugging, no file handling */
/* is required. */
};
/* FILE is typedef¡ˉ d in stdio.h. */
//FILE __stdout;
//¶¨òå_sys_exit()òÔ±üÃaê1óðëÖ÷»úÄ£ê½
void _sys_exit(int x)
{
x = x;
}
//Öض¨òåfputcoˉêy
int fputc(int ch, FILE *f)
{
while((USART1->SR&0X40)==0);//Ñ-»··¢Ëí,Ö±μ½·¢Ëííê±Ï
USART1->DR = (u8) ch;
return ch;
}
#endif
//end
//////////////////////////////////////////////////////////////////
}[/mw_shl_code]
一周热门 更多>