Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/perkss/c-programming-examples
Some C Programming Examples from the Tutorials on my blog
https://github.com/perkss/c-programming-examples
c cmake curl makefile pointers programming-pearls
Last synced: 28 days ago
JSON representation
Some C Programming Examples from the Tutorials on my blog
- Host: GitHub
- URL: https://github.com/perkss/c-programming-examples
- Owner: perkss
- Created: 2018-01-19T10:30:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-29T19:40:57.000Z (about 4 years ago)
- Last Synced: 2024-11-10T00:02:43.896Z (3 months ago)
- Topics: c, cmake, curl, makefile, pointers, programming-pearls
- Language: C
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#To Compile
# Glib Examples
To run the GLIB examples you require the Library glib-2.0.
One of the pain points of C is linking libraries and using them, so how do we
get glib into our project the simple recommended way is to use `pkg-config` like so```shell script
gcc `pkg-config --cflags --libs glib-2.0` -o ex-compile ex-compile.c
```To fully understand getting the library we can link it using the common `-l` approach.
We can can use `pkg-config` to find the locations and the dependent libraries required to get the library imported.
`pkg-config` will commonly be installed, but on a mac if not use
```shell script
brew install pkg-config
```Then you can search for the required library paths and header paths to compile your example with the
required `glib-2.0` library. This does the equivalent of the command above specifying the `--cflags --libs`
part.```shell script
$ pkg-config --cflags glib-2.0
-I/usr/local/Cellar/glib/2.56.0/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.0/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.44/include
$ pkg-config --libs glib-2.0
-L/usr/local/Cellar/glib/2.56.0/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lintl -Wl,-framework -Wl,CoreFoundation
```Then the results of these two commands can be used as so
```shell script
gcc ex-compile.c -o compile -lglib-2.0 -lintl -I/usr/local/Cellar/glib/2.56.0/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.0/lib/glib-2.0/include
```# Libcurl Example Against ElasticSearch
A nice example of very basic interaction with ElasticSearch via Rest and libCurl with C.# Programming Pearls Examples
You will find code examples and solutions for programming pearls in the relevant directories.To run:
```shell script
gcc -o
```# Weak References