Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Error C2059: syntax errors: "constant" solution

Shulou Source: shulou.com Published: 2022-06-02 19:54:53 09月27日 Update

Scene

Add Haikang, Yushi SDK docking header file and library file, compilation error prompt error C2059: syntax error: "constant". Display macro definition exception in SDK header file NetDEVSDK.h

Typedef enum tagNETDEV_PASSIVEDECODE_CMD

{

PASSIVE_DEC_PAUSE = 1, / * passive decoding paused (valid only for file streams) * /

PASSIVE_DEC_RESUME = 2, / * resume passive decoding (valid only for file streams) * /

PASSIVE_DEC_FAST = 3, / * Fast passive decoding (valid only for file streams) * /

PASSIVE_DEC_SLOW = 4, / * slow passive decoding (valid only for file streams) * /

PASSIVE_DEC_NORMAL = 5, / * normal passive decoding (valid only for file streams) * /

PASSIVE_DEC_ONEBYONE = 6, / * passive decoding single frame playback (reserved) * /

PASSIVE_DEC_AUDIO_ON = 7, / * Audio on * /

PASSIVE_DEC_AUDIO_OFF = 8, / * Audio off * /

PASSIVE_DEC_RESETBUFFER = 9 / * clear buffer * /

} NETDEV_PASSIVEDECODE_CMD_E

NetDEVSDK.h (5082): error C2059: syntax error: "constant"

NetDEVSDK.h (5091): error C2143: syntax error: missing ";" (before "}")

Mouse over PASSIVE_DEC_PAUSE and see error message: # define PASSIVE_DEC_PAUSE 1

Investigation process

Do a macro definition search PASSIVE_DEC_PAUSE on the entire project directory in Notepad++, and find that HCNetSDK.h has been defined in Haikang's header file.

# define PASSIVE_DEC_PAUSE 1 / * passive decoding paused (valid for file streams only) * /

# define PASSIVE_DEC_RESUME 2 / * resume passive decoding (valid only for file streams) * /

# define PASSIVE_DEC_FAST 3 / * Fast passive decoding (valid only for file streams) * /

# define PASSIVE_DEC_SLOW 4 / * slow passive decoding (valid for file streams only) * /

# define PASSIVE_DEC_NORMAL 5 / * normal passive decoding (valid only for file streams) * /

# define PASSIVE_DEC_ONEBYONE 6 / * passive decoding single frame playback (reserved) * /

# define PASSIVE_DEC_AUDIO_ON 7 / * Audio enabled * /

# define PASSIVE_DEC_AUDIO_OFF 8 / * Audio off * /

# define PASSIVE_DEC_RESETBUFFER 9 / * clear buffer * /

That's why the above prompt error occurred.

Solution

The use of the NETDEV_PASSIVEDECODE_CMD_E macro definition was not found in the SDK header file, so the whole macro definition was commented out directly to solve the problem.

Tags: Files valid error audio syntax prompts constants buffers slow Haikang search buffering solutions scenarios projects library files comments directories procedures Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Xiaomi vpn OPPO Reno