Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Error C2059: syntax errors: "constant" solution

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report