Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C2059 syntax error 'string' ?

Tags:

c++

c

extern "C" 
{
#endif
#include <stdint.h>
#include <limits.h>
#include "attributes.h"
}
#endif

I added extern "C" { } Then i got the C2059 string error So i tried to use #endif, now i have another 4 errors.

Error   1   error C2059: syntax error : 'string'    d:\c-sharp\c++ 
compiling\consoleapplication7\consoleapplication7\libavutil\rational.h 31 1
ConsoleApplication7

How can i fix this string error ?

like image 852
Ben Kochavi Avatar asked Apr 23 '13 12:04

Ben Kochavi


1 Answers

At a guess, are you including this code from a C source file?

extern "C" { guards are only required (or understood) by C++. You can omit them from a C file, should include them in a C++ file and should guard them with a __cplusplus ifdef in a header file.

#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <limits.h>
#include "attributes.h"
#ifdef __cplusplus
}
#endif
like image 191
simonc Avatar answered Sep 21 '22 21:09

simonc