C2059 error de sintaxis 'cadena'?

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

yo añadí 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 ?

preguntado el 23 de abril de 13 a las 13:04

¿Por qué haces esto en primer lugar? -

#ifdef X ... #endif is normally how it goes, not #endif twice. Unless you haven't posted all your code? -

Los programas extern "C" { declaration and closing } would normally be enclosed by #ifdef __cplusplus, #endif. If you don't do this, you'd have to ensure your header wasn't included from a C source file -

Por favor publique el empresas de confitería code, as complete as possible (also please see sscce.org for help). Then please post the complete and unedited error messages, while pointing out what line in the source they are about. -

Joachim the original post the problem of my code is here: stackoverflow.com/questions/16155783/… i have 9 erorrs of this link. I tried to google and tried any solution copied all bin files and dll files to the debug and to the solution directories nothing helped. So i tried this extern "C" but it didn't help either. Can't figure out why this errors happen. -

1 Respuestas

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

Respondido 23 Abr '13, 14:04

You wouldn't normally put the headers within the extern "C" { } sección. - Peter Wood

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.