create project HelloShared.
File->New->C Project
project name:HelloShared
Project type:Shared Library->Empty Project
Toolcains:Linux GCC
create HelloShared.h:
/* * HelloShared.h */ #ifndef HELLOSHARED_H_ #define HELLOSHARED_H_ void helloShared(const char *name); #endif /* HELLOSHARED_H_ */
create HelloShared.c:
/* * HelloShared.c */ #include <stdio.h> void helloShared(const char *name) { printf("helloShared %s!\n", name); }
Build Project HelloShared.
create project HelloApp:
File->New->C Project
project name:HelloApp
Project type:Executable->Empty Project
Toolcains:Linux GCC
Properties for HelloApp:
C/C++ General-->Paths and Symbols:
Includes:/HelloShared
Libraries:HelloShared
LibraryPaths:/HelloShared/Debug
References:HelloShared
create main.c:
#include "HelloShared.h" #include <stdio.h> int main() { helloShared("cj"); return 0; }
Build Project HelloApp.
debug configurations-->Environment
LD_LIBRARY_PATH = ${workspace_loc:/HelloShared/Debug}
run main.c
helloShared cj!