Skip to content

Commit

Permalink
adding Posix & GNU definition support
Browse files Browse the repository at this point in the history
adding Posix & GNU definition support
  • Loading branch information
wodowiesel committed Jul 25, 2019
1 parent 6235a32 commit 96abdf8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-D_POSIX_C_SOURCE=199309L)
add_executable (pifunk pifunk.c)
add_definitions(-D_POSIX_C_SOURCE=200809L)
add_definitions(-D_GNU_SOURCE)
add_executable(pifunk pifunk.c)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ STD_CFLAGS=-Wall -std=c99 -g3 -ggdb -v -Iinclude -I/opt/vc/include -fPIC pifunk.
CXX=g++
CXXFLAGS=-Wall -std=c++17 -g3 -ggdb -v -Iinclude -I/opt/vc/include -fPIC pifunk.c -O3
ASFLAGS=-s
LDFLAGS=-lm -lpthread -lsndfile -D_USE_MATH_DEFINES -D_POSIX_C_SOURCE=199309L -L/opt/vc/lib -lbcm_host
LDFLAGS=-lm -lpthread -lsndfile -D_USE_MATH_DEFINES -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -L/opt/vc/lib -lbcm_host
#-lgthread
LDLIBS=-Llib -shared
PATH=/home/pi
Expand Down
8 changes: 4 additions & 4 deletions pifunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ cd PiFunk // goto path
->lm flag for math lib (obligatory), -g3 for debugger, -c for not linkin to library
=>compile with admin/root permissions!!
sudo gcc -g3 -std=c99 -lm -Iinclude -Llib -lsndfile -D_USE_MATH_DEFINES -D_POSIX_C_SOURCE=199309L -L/opt/vc/lib -lbcm_host -fPIC pifunk.c -shared -O3 -o include/pifunk.i lib/pifunk.s lib/pifunk.o lib/pifunk.a lib/pifunk.so lib/pifunk.lib
sudo gcc -g3 -std=c99 -lm -Iinclude -Llib -lsndfile -D_USE_MATH_DEFINES -D_POSIX_C_SOURCE=199309L -L/opt/vc/lib -lbcm_host -fPIC pifunk.c -shared -O3 -o bin/pifunk bin/pifunk.out
sudo gcc -g3 -std=c99 -lm -Iinclude -Llib -lsndfile -D_USE_MATH_DEFINES -D_GNU_C_SOURCE -D_POSIX_C_SOURCE=199309L -L/opt/vc/lib -lbcm_host -fPIC pifunk.c -shared -O3 -o include/pifunk.i lib/pifunk.s lib/pifunk.o lib/pifunk.a lib/pifunk.so lib/pifunk.lib
sudo gcc -g3 -std=c99 -lm -Iinclude -Llib -lsndfile -D_USE_MATH_DEFINES -D_GNU_SOURCE -D_POSIX_C_SOURCE=199309L -L/opt/vc/lib -lbcm_host -fPIC pifunk.c -shared -O3 -o bin/pifunk bin/pifunk.out
or do make (compile flags in make included)
-std=c99 is the same as -std=iso9899:1999 or =gnu99 or -std=c++17 (11/14)
-E tells to stop after preprocessing stage
Expand Down Expand Up @@ -203,7 +203,7 @@ using namespace std;
//printf ("Program runs under ARM-Architecture!");
//#pragma ARM
// same as -CODE32
//#error
//#error
#endif

#ifdef __GNUC__
Expand All @@ -224,7 +224,7 @@ using namespace std;
#define VERSION_STATUS "e"

#define _GNU_SOURCE
#define _POSIX_C_SOURCE 199309L
#define _POSIX_C_SOURCE = 200809L //or 199309L
#define _USE_MATH_DEFINES

//---- PI specific stuff
Expand Down

0 comments on commit 96abdf8

Please sign in to comment.