Вопрос по c – C-библиотека не связывает с помощью gcc / g ++

21

Error: User Rate Limit Exceeded

gcc -g -Wall -I <path to custom headers> -o program main.c customlibrary.lib -lm -lpthread

Error: User Rate Limit Exceeded

g++ -g -Wall -I <path to custom headers> -o program main.cpp customlibrary.lib -lm -lpthread

Error: User Rate Limit Exceeded

gcc -g -Wall -I <path to custom headers> -o program main.cpp customlibrary.lib -lm -lpthread -lstdc++

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Ваш Ответ

3   ответа
38

extern "C" {
#include "customlibrary.h"
}

customlibrary.h

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif
Error: User Rate Limit Exceeded__cplusplusError: User Rate Limit Exceeded
2

#ifdef __cplusplus
extern "C" {
#endif

// ...

#ifdef __cplusplus
} /* extern "C" */
#endif

4

// myfile.cpp
extern "C" int libfun();    // C function in your library

// myfile.cpp
extern "C" {
  #include "mylibdefs.h"      // defs for your C library functions
}

Похожие вопросы