error C2061: syntax error : identifier 'THIS_FILE'

本文解决了C++项目中出现的多个编译错误,包括标识符语法错误、函数返回类型错误等。通过调整预编译头文件stdafxv.h的内容,如提前引入标准库的包含指令并使用命名空间std,成功解决了这些问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

莫名其妙错误如下:

error C2061: syntax error : identifier 'THIS_FILE'
error C2091: function returns function
error C2809: 'operator new' has no formal parameters
error C2061: syntax error : identifier 'THIS_FILE'
error C2091: function returns function

修改如下:

在stdafxv.h中将定义提前到最前端即可:

#include <map>
#include <list>
using namespace std;

....其它头文件

我用了上述你给我提供的代码,出现了下列问题,请根据这些问题修改代码并且将修改后的完整代码发给我 222.c(107): error C141: syntax error near 'unsigned', expected '__asm' 222.c(107): error C141: syntax error near '}', expected ';' 222.c(108): error C202: 'days_in_month': undefined identifier 222.c(110): error C202: 'days_in_month': undefined identifier 222.c(169): error C141: syntax error near 'unsigned', expected '__asm' 222.c(169): error C202: 'LSB': undefined identifier 222.c(170): error C141: syntax error near 'unsigned', expected '__asm' 222.c(170): error C202: 'MSB': undefined identifier 222.c(171): error C202: 'MSB': undefined identifier 222.c(286): error C141: syntax error near 'unsigned', expected '__asm' 222.c(286): error C202: 'seconds': undefined identifier 222.c(287): error C141: syntax error near 'unsigned', expected '__asm' 222.c(287): error C202: 'ms': undefined identifier 222.c(291): error C202: 'seconds': undefined identifier 222.c(476): error C141: syntax error near 'static', expected '__asm' 222.c(476): error C202: 'temp_counter': undefined identifier 222.c(477): error C202: 'temp_counter': undefined identifier 222.c(478): error C202: 'temp_counter': undefined identifier 222.c(491): error C141: syntax error near 'static', expected '__asm' 222.c(491): error C202: 'ms_counter': undefined identifier 222.c(492): error C141: syntax error near 'static', expected '__asm' 222.c(492): error C202: 'sec_counter': undefined identifier 222.c(494): error C202: 'ms_counter': undefined identifier 222.c(503): error C202: 'ms_counter': undefined identifier 222.c(504): error C202: 'ms_counter': undefined identifier Target not created.
06-21
在你所给的代码中。出现了以下问题,怎么修改呢 SOFT_I2C.H(3): error C202: 'P2': undefined identifier SOFT_I2C.H(4): error C202: 'P2': undefined identifier SOFT_I2C.H(9): error C141: syntax error near 'dat', expected ')' SOFT_I2C.H(10): error C129: missing ';' before 'I2C_ReadByte' compiling DHT11.c... 新建文件夹\DHT11.c(1): warning C318: can't open file 'DHT11.h' 新建文件夹\DHT11.C(3): error C141: syntax error near 'n', expected ')' 新建文件夹\DHT11.C(4): error C202: 'n': undefined identifier compiling DS1302.c... 新建文件夹\DS1302.H(5): error C141: syntax error near 'uint8_t' 新建文件夹\DS1302.H(5): error C129: missing ';' before 'year' compiling OLED.c... SOFT_I2C.H(3): error C202: 'P2': undefined identifier SOFT_I2C.H(4): error C202: 'P2': undefined identifier SOFT_I2C.H(9): error C141: syntax error near 'dat', expected ')' SOFT_I2C.H(10): error C129: missing ';' before 'I2C_ReadByte' 新建文件夹\OLED.c(2): warning C318: can't open file 'font.h' compiling main.c... 新建文件夹\main.c(1): warning C318: can't open file 'STC12C5A60S2.H' 新建文件夹\main.c(2): warning C318: can't open file 'DHT11.h' SOFT_I2C.H(3): error C202: 'P2': undefined identifier SOFT_I2C.H(4): error C202: 'P2': undefined identifier SOFT_I2C.H(9): error C141: syntax error near 'dat', expected ')' SOFT_I2C.H(10): error C129: missing ';' before 'I2C_ReadByte' compiling ADC.c... 新建文件夹\ADC.H(4): error C129: missing ';' before 'ADC_Read' compiling soft_i2c.c... SOFT_I2C.H(3): error C202: 'P2': undefined identifier SOFT_I2C.H(4): error C202: 'P2': undefined identifier SOFT_I2C.H(9): error C141: syntax error near 'dat', expected ')' SOFT_I2C.H(10): error C129: missing ';' before 'I2C_ReadByte' 目标未创建
06-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值