I' m trying to setup a simple tool to measure different aspects of a system. I build a project which can log an accelerometer, gyroscope and a magnetometer. I want full control of the the program so I decided not to use any usr/local kind of libraries and keep all files in the project folder. All files all working. I want to make the structure of my program as follows: https://www.dropbox.com/s/59s3si8spvkdq98/filestructure.png (not enough REP). I don't have much experience in making Makefiles, except changing a few variables. I work in the Embedded environment and mostly with IDE's.
I tried building my project with the following Makefile:
# Project name
NAME = TEST
# Tools
CC = gcc
CFLAGS = -o
# Paths
DRV_PATH = drivers
SRC_PATH = src
LIB_PATH = libs
# includes
INCLUDES = -I $(DRV_PATH) -I $(LIB_PATH) -I $(SRC_PATH)
# what files do we need to compile?
# libraries
MY_LIB = $(LIB_PATH)/bcm2835.c
# main files
MAIN = main.c
# src files
#MY_SRC = $(SRC_PATH)/vector.c
MY_SRC += $(SRC_PATH)/dcm.c
# select drivers to compile
DRV_SRC = $(DRV_PATH)/adxl345.c
DRV_SRC += $(DRV_PATH)/itg3200.c
DRV_SRC += $(DRV_PATH)/hmc5883l.c
DRV_SRC += $(DRV_PATH)/gy-85.c
DRV_SRC += $(DRV_PATH)/nrf24l01.c
# bundle files
ALL_SRC = $(MY_LIB) $(DRV_SRC) $(MY_SRC) $(MAIN)
OBJ = $(ALL:.c=.o)
BIN = $(ALL:.c=)
# make commands
all:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC)
debug:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC) -DDEBUG=1
imudebug:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC) -DIMUDEBUG=1
nrfdebug:
$(CC) $(CFLAGS) $(NAME) $(ALL_SRC) -DNRFDEBUG=1
I use the different make commands to generate some debug output.
The config file currently includes all files and is as follows:
#ifndef CONFIG_H
#define CONFIG_H
/* includes */
#include <stdio.h>
#include <math.h>
/* libs */
#include <bcm2835.h>
/* drivers */
#include "gy-85.h"
#include "adxl345.h"
#include "itg3200.h"
#include "hmcl5883l.h"
#include "nrf24l01.h"
/* src */
#include "dcm.h"
#endif // __CONFIG_H__
And the dcm.h file looks as follows. I tried t keep all .h files like this:
#ifndef DCM_H
#define DCM_H
#include <bcm2835.h>
#include <stdio.h>
#include <math.h>
#include "gy-85.h"
double pitch, roll, yaw;
double DCM_Matrix[3][3];
uint64_t stamp;
void resetFusion(void);
#endif
This is my make result:
gcc -o TEST libs/bcm2835.c drivers/adxl345.c drivers/itg3200.c drivers/hmc5883l.c drivers/gy-85.c drivers/nrf24l01.c src/dcm.c main.c
In file included from drivers/adxl345.c:1:0:
drivers/adxl345.h:4:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
In file included from drivers/itg3200.c:1:0:
drivers/itg3200.h:4:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
drivers/hmc5883l.c: In function ‘magInit’:
drivers/hmc5883l.c:7:30: error: ‘MAG_ADDR’ undeclared (first use in this function)
drivers/hmc5883l.c:7:30: note: each undeclared identifier is reported only once for each function it appears in
drivers/hmc5883l.c:14:17: error: ‘MODE’ undeclared (first use in this function)
drivers/hmc5883l.c:14:23: error: ‘CONTINUOUS’ undeclared (first use in this function)
drivers/hmc5883l.c:22:17: error: ‘CONA’ undeclared (first use in this function)
drivers/hmc5883l.c:22:23: error: ‘RATE_50HZ’ undeclared (first use in this function)
drivers/hmc5883l.c: In function ‘magRead’:
drivers/hmc5883l.c:37:30: error: ‘MAG_ADDR’ undeclared (first use in this function)
drivers/hmc5883l.c:38:18: error: ‘DATA’ undeclared (first use in this function)
drivers/hmc5883l.c: In function ‘magGetRegister’:
drivers/hmc5883l.c:60:13: error: ‘BCM2835_I2C_REASON_OK’ undeclared (first use in this function)
drivers/hmc5883l.c:61:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
drivers/hmc5883l.c: At top level:
drivers/hmc5883l.c:71:6: warning: conflicting types for ‘magGetRegisters’ [enabled by default]
drivers/hmc5883l.c:38:2: note: previous implicit declaration of ‘magGetRegisters’ was here
drivers/hmc5883l.c: In function ‘magGetRegisters’:
drivers/hmc5883l.c:79:13: error: ‘BCM2835_I2C_REASON_OK’ undeclared (first use in this function)
drivers/hmc5883l.c:80:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
drivers/hmc5883l.c: At top level:
drivers/hmc5883l.c:97:6: warning: conflicting types for ‘magSetRegister’ [enabled by default]
drivers/hmc5883l.c:14:2: note: previous implicit declaration of ‘magSetRegister’ was here
drivers/hmc5883l.c: In function ‘magSetRegister’:
drivers/hmc5883l.c:107:13: error: ‘BCM2835_I2C_REASON_OK’ undeclared (first use in this function)
drivers/hmc5883l.c:108:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
drivers/gy-85.c: In function ‘gyInit’:
drivers/gy-85.c:15:30: error: ‘BCM2835_I2C_CLOCK_DIVIDER_2500’ undeclared (first use in this function)
drivers/gy-85.c:15:30: note: each undeclared identifier is reported only once for each function it appears in
drivers/gy-85.c: In function ‘gyUpdate’:
drivers/gy-85.c:29:2: error: unknown type name ‘int16_t’
drivers/gy-85.c:30:2: error: unknown type name ‘uint8_t’
drivers/gy-85.c:32:9: error: ‘int16_t’ undeclared (first use in this function)
drivers/gy-85.c:32:18: error: expected expression before ‘)’ token
drivers/gy-85.c:40:18: error: expected expression before ‘)’ token
drivers/gy-85.c:47:18: error: expected expression before ‘)’ token
drivers/gy-85.c:61:2: warning: return from incompatible pointer type [enabled by default]
In file included from drivers/nrf24l01.c:1:0:
drivers/nrf24l01.h:5:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
In file included from src/dcm.c:1:0:
src/dcm.h:4:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
In file included from main.c:1:0:
config.h:9:21: fatal error: bcm2835.h: No such file or directory
compilation terminated.
make: *** [all] Error 1
If you can point out the main problem with my file structure I would be so glad!
Current error list:
gcc -o TEST -I libs -I drivers -I src libs/bcm2835.c drivers/adxl345.c drivers/itg3200.c drivers/hmc5883l.c drivers/gy-85.c drivers/nrf24l01.c src/dcm.c main.c
drivers/gy-85.c: In function ‘gyUpdate’:
drivers/gy-85.c:63:2: warning: return from incompatible pointer type [enabled by default]
main.c: In function ‘main’:
main.c:51:4: warning: passing argument 1 of ‘nrf24Transmit’ from incompatible pointer type [enabled by default]
drivers/nrf24l01.h:145:9: note: expected ‘uint8_t *’ but argument is of type ‘uint64_t *’
/tmp/ccOWR401.o:(.bss+0x0): multiple definition of `accelRaw'
/tmp/cc1gy1Bh.o:(.bss+0x0): first defined here
/tmp/ccOWR401.o:(.bss+0x8): multiple definition of `accelBias'
/tmp/cc1gy1Bh.o:(.bss+0x8): first defined here
/tmp/ccyZlhJe.o:(.bss+0x0): multiple definition of `accelRaw'
/tmp/cc1gy1Bh.o:(.bss+0x0): first defined here
/tmp/ccyZlhJe.o:(.bss+0x8): multiple definition of `accelBias'
/tmp/cc1gy1Bh.o:(.bss+0x8): first defined here
/tmp/ccUbOIyA.o:(.bss+0x0): multiple definition of `accelRaw'
/tmp/cc1gy1Bh.o:(.bss+0x0): first defined here
/tmp/ccUbOIyA.o:(.bss+0x8): multiple definition of `accelBias'
/tmp/cc1gy1Bh.o:(.bss+0x8): first defined here
/tmp/ccyZlhJe.o: In function `resetFusion':
dcm.c:(.text+0x38): undefined reference to `atan2'
collect2: ld returned 1 exit status
make: *** [all] Error 1
You don't have your includes in your rule
INCLUDES = -I $(DRV_PATH) -I $(LIB_PATH) -I $(SRC_PATH)
This just seems to dangle. Simplest solution to my eyes is to move down your CFLAGS definition and add in the includes:
INCLUDES = -I $(DRV_PATH) -I $(LIB_PATH) -I $(SRC_PATH)
CFLAGS = -o $(INCLUDES)
This way you don't have to change anything else. Of course, there are alternatives, this one just looks easiest.
Related
I'm very rookie on SQL and database but my final target is extract all the blob images from a database filed but this is impossible to me. I'm using SQLite and DB Browser for SQLite but I don¡t know how to load the extension.
I have tried to load the fileio.c as extension by the "Load Extension", but Browser only detects .dll and .so.
Ok, I'm trying then to build the fileio.c file by MinGW like this:
C:\Users\juan_>gcc -g -shared ext\misc\fileio.c -o fileio.dll
But then, the compilation doesn't find sqlite3ext.h neither sqlite3.c.
I have downloaded these files from sqlite amalgamation, but now, there is other problem while building:
C:\Users\juan_>gcc -g -shared sqlite-amalgamation-3400100\fileio.c -o fileio.dll
sqlite-amalgamation-3400100\fileio.c:99:30: fatal error: test_windirent.h: No such file or directory
# include "test_windirent.h"
Then, I have found this file in one folder inside sqlite-master (from github, where i could find fileio.c extension).
I add all the amalgamation files in src folder, and retry the building:
sqlite-master\src\fileio.c: In function 'writefileFunc':
sqlite-master\src\fileio.c:513:9: warning: implicit declaration of function 'S_ISLNK' [-Wimplicit-function-declaration]
if( S_ISLNK(mode) ){
^~~~~~~
sqlite-master\src\fileio.c: At top level:
sqlite-master\src\fileio.c:567:3: error: unknown type name 'DIR'
DIR *pDir; /* From opendir() */
^~~
sqlite-master\src\fileio.c: In function 'fsdirResetCursor':
sqlite-master\src\fileio.c:648:22: warning: implicit declaration of function 'closedir' [-Wimplicit-function-declaration]
if( pLvl->pDir ) closedir(pLvl->pDir);
^~~~~~~~
sqlite-master\src\fileio.c: In function 'fsdirNext':
sqlite-master\src\fileio.c:711:18: warning: implicit declaration of function 'opendir' [-Wimplicit-function-declaration]
pLvl->pDir = opendir(pLvl->zDir);
^~~~~~~
sqlite-master\src\fileio.c:711:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
pLvl->pDir = opendir(pLvl->zDir);
^
sqlite-master\src\fileio.c:720:29: warning: implicit declaration of function 'readdir' [-Wimplicit-function-declaration]
struct dirent *pEntry = readdir(pLvl->pDir);
^~~~~~~
sqlite-master\src\fileio.c:720:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
sqlite-master\src\fileio.c:722:17: error: dereferencing pointer to incomplete type 'struct DIRENT'
if( pEntry->d_name[0]=='.' ){
^~
Is this not the way to get the fileio.dll extension? I hear other kind of advise like using other program or something like that.
I'm trying to compile demo main file (https post with the chunked-encoding data) from github repo using, I have installed libghc-iproute-dev and libnl3.
gcc -o main -Imbedtls/include -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" main.c -O2 mbedtls/library/libmbedx509.a mbedtls/library/libmbedtls.a mbedtls/library/libmbedcrypto.a
I can't compile porgram, here is what I got:
main.c: In function ‘main’:
main.c:133:8: warning: implicit declaration of function ‘http_open_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_open_chunked(&hi2, url) == 0)
^~~~~~~~~~~~~~~~~
http_read_chunked
main.c:137:12: warning: implicit declaration of function ‘http_write_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_write_chunked(&hi2, data, size) != size)
^~~~~~~~~~~~~~~~~~
http_read_chunked
/tmp/cc7m6wMn.o: In function main': main.c:(.text.startup+0x3b): undefined reference to http_init'
main.c:(.text.startup+0x48): undefined reference to http_init' main.c:(.text.startup+0x59): undefined reference to http_open_chunked'
main.c:(.text.startup+0x9e): undefined reference to http_write_chunked' main.c:(.text.startup+0xd3): undefined reference to http_write_chunked'
main.c:(.text.startup+0x120): undefined reference to http_write_chunked' main.c:(.text.startup+0x139): undefined reference to http_strerror'
main.c:(.text.startup+0x157): undefined reference to http_close' main.c:(.text.startup+0x15f): undefined reference to http_close'
main.c:(.text.startup+0x19c): undefine
d reference to `http_read_chunked'
collect2: error: ld returned 1 exit status
I also tried to include netlink libraries, using:
#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
And try to compile using the line:
gcc -o main -fPIC -DHAVE_CONFIG_H -D_U_="attribute((unused))" -O2 -I/usr/include/libnl3/netlink/ -Imbedtls/include main.c ApiService.c mbedtls/library/libmbedx509.a mbedtls/library/libmbedtls.a mbedtls/library/libmbedcrypto.a
Then I got:
ApiService.c:17:8: warning: implicit declaration of function ‘http_open_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_open_chunked(&hi2, url) == 0)
^~~~~~~~~~~~~~~~~
http_read_chunked
ApiService.c:21:12: warning: implicit declaration of function ‘http_write_chunked’; did you mean ‘http_read_chunked’? [-Wimplicit-function-declaration]
if(http_write_chunked(&hi2, data, size) != size)
^~~~~~~~~~~~~~~~~~
http_read_chunked
ApiService.c: In function ‘getTask’:
ApiService.c:106:5: warning: format not a string literal and no format arguments [-Wformat-security]
sprintf(data, cJSON_Print(task));
^~~~~~~
https.c: In function ‘mbedtls_net_connect_timeout’:
https.c:496:18: error: ‘errno’ undeclared (first use in this function); did you mean ‘h_errno’?
else if( errno == EINPROGRESS )
^~~~~
h_errno
https.c:496:18: note: each undeclared identifier is reported only once for each function it appears in
https.c:496:27: error: ‘EINPROGRESS’ undeclared (first use in this function)
else if( errno == EINPROGRESS )
^~~~~~~~~~~
https.c:515:33: error: ‘EINTR’ undeclared (first use in this function); did you mean ‘NLE_INTR’?
if(errno == EINTR) continue;
^~~~~
NLE_INTR
Makefile:16: recipe for target 'compile' failed
Link to repo https://github.com/HISONA/https_client.
Please help I trying to compile that whole day, nothing works for me.
The implicit declaration of function error means that the compiler cannot locate the function in your workspace. you should indicate to the caller where the http_open_chunked function reside in your code by including the header (.h) file where it is impleented.
I've downloaded ximpleware_2.11_c.zip (C version of vtd-xml), when I
have tried to compile it under linux I've the following error messages:
In file included from vtdNav.c:19:
vtdNav.h:82: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h:506: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h: In function ‘writeIndex_VTDNav’:
vtdNav.c: At top level:
vtdNav.c:3410: error: conflicting types for ‘writeIndex_VTDNav’
vtdNav.h:347: error: previous declaration of ‘writeIndex_VTDNav’ was here
vtdNav.c: In function ‘dumpXML’:
vtdNav.c:3554: error: too many arguments to function ‘dumpXML2’
vtdNav.c: At top level:
vtdNav.c:3562: error: conflicting types for ‘dumpXML2’
vtdNav.h:362: error: previous declaration of ‘dumpXML2’ was here
In file included from vtdNav.c:19:
vtdNav.h:82: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h:506: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h: In function ‘writeIndex_VTDNav’:
vtdNav.h:507: error: ‘f’ undeclared (first use in this function)
vtdNav.h:507: error: (Each undeclared identifier is reported only once
vtdNav.h:507: error: for each function it appears in.)
vtdNav.h:507: error: too many arguments to function
‘vn->__writeIndex_VTDNav’
vtdNav.h: At top level:
vtdNav.h:675: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.h:695: error: expected declaration specifiers or ‘...’ before ‘FILE’
vtdNav.c: In function ‘_writeIndex2_VTDNav’:
vtdNav.c:3751: error: too many arguments to function ‘writeIndex_VTDNav’
vtdNav.c: In function ‘dumpXML’:
vtdNav.c:3874: error: too many arguments to function ‘dumpXML2’
vtdNav.c: At top level:
vtdNav.c:3882: error: conflicting types for ‘dumpXML2’
vtdNav.h:695: error: previous declaration of ‘dumpXML2’ was here
make: *** [vtdNav.o] Error 1
How can I build it under linux ?
Thanks for your response.
I've put
#include <stdio.h>
in :
vtdNav.h and in transcoder.h
and now it compile.
I'm sorry to have put a post to ask how to compile the examples. I have compiled them by modifying the makefile already present in ximpleware_2.11_c and in this way works:
CC=gcc
CFLAGS= -c -O3 -Wall -Winline -fgnu89-inline -fomit-frame-pointer-fforce-addr -frerun-cse-after-loop -fexpensive-optimizations -fregmove -frerun-loop-opt -fmerge-all-constants -fno-branch-count-reg -funroll-loops -fpeephole -march=core2-falign-functions -falign-loops -falign-jumps -freorder-blocks -freorder-functions-fprefetch-loop-arrays -funswitch-loops -fbranch-target-load-optimize2 -fvpt --paraminline-unit-growth=300 --param max-inline-recursive-depth=2 --param large-function-growth=600
CFLAGS2 = -c -ggdb
LDFLAGS = -O3 -fomit-frame-pointer -fforce-addr -frerun-cse-after-loop-fexpensive-optimizations -fregmove -frerun-loop-opt -march=core2 -lm
LDFLAGS2 = -ggdb
all : hello_world
hello_world: hello_world.o ../../arrayList.o ../../fastIntBuffer.o ../../fastLongBuffer.o ../../contextBuffer.o ../../vtdNav.o ../../vtdGen.o ../../autoPilot.o ../../XMLChar.o ../../helper.o ../../lex.yy.o ../../l8.tab.o ../../literalExpr.o ../../numberExpr.o ../../pathExpr.o ../../filterExpr.o ../../binaryExpr.o ../../unaryExpr.o ../../funcExpr.o ../../locationPathExpr.o ../../intHash.o ../../unionExpr.o ../../decoder.o ../../XMLModifier.o ../../nodeRecorder.o ../../indexHandler.o ../../bookMark.o ../../elementFragmentNs.o ../../transcoder.o ../../textIter.o ../../variableExpr.o ../../cachedExpr.o
clean:
-rm *.o
hello_world.o : hello_world.c
${CC} ${CFLAGS} hello_world.c
I am converting a gnome panel applet to xfce panel plugin. I have so far removed the few gnome specific parts in the source and replaced them with xfce specific source as appropriate.
I created makefile.am and configure.ac files using templates such as the weather plugin and the example plugin. However I am unsuccessful in getting it compiled properly. I am probably missing something obvious, but I double checked the examples with my own files and found no obvious problems.
I have attached the appropriate files as well as output of the errors in the hope someone has an idea. I don't think the problem is in the actual source, but I can add some of that later if necessary.
Errors while compiling:
make all-recursive
make[1]: Entering directory `/source/my_example_xfce'
Making all in panel-plugin
make[2]: Entering directory `/source/my_example_xfce/panel-plugin'
gcc -DHAVE_CONFIG_H -I. -I.. -I.. -DTHEMESDIR=\"/usr/local/share/xfce4/my_example/icons\" -DPACKAGE_LOCALE_DIR=\"/usr/local/share/locale\" -DG_LOG_DOMAIN=\"my_example\" -DNDEBUG -pthread -I/usr/include/xfce4/libxfce4panel-1.0 -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/xfce4 -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/atk-1.0 -I/usr/include/xfce4 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/xfce4 -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT xfce4_my_example_plugin-my_example.o -MD -MP -MF .deps/xfce4_my_example_plugin-my_example.Tpo -c -o xfce4_my_example_plugin-my_example.o `test -f 'my_example.c' || echo './'`my_example.c
my_example.c:25:25: warning: ‘struct Example_Data’ declared inside parameter list [enabled by default]
my_example.c:25:25: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
my_example.c: In function ‘setdefaults’:
my_example.c:28:3: warning: incompatible implicit declaration of built-in function ‘strncpy’ [enabled by default]
my_example.c:28:21: error: dereferencing pointer to incomplete type
my_example.c:28:45: warning: incompatible implicit declaration of built-in function ‘strlen’ [enabled by default]
my_example.c:28:3: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast [enabled by default]
my_example.c:28:3: note: expected ‘const char *’ but argument is of type ‘int’
my_example.c:28:3: warning: passing argument 2 of ‘strncpy’ makes pointer from integer without a cast [enabled by default]
my_example.c:28:3: note: expected ‘const char *’ but argument is of type ‘int’
my_example.c:30:21: error: dereferencing pointer to incomplete type
my_example.c:30:42: error: dereferencing pointer to incomplete type
my_example.c:30:67: error: dereferencing pointer to incomplete type
my_example.c:31:3: warning: incompatible implicit declaration of built-in function ‘strncat’ [enabled by default]
my_example.c:31:21: error: dereferencing pointer to incomplete type
my_example.c:31:32: error: ‘SIGFILE’ undeclared (first use in this function)
SIGFILE is one of the defines in my header files. Then it goes on as if it never read my header files with all the declarations.
Last bit:
my_example.c:248:17: error: unknown type name ‘XfcePanelPlugin’
my_example.c:248:42: error: unknown type name ‘GtkWidget’
my_example.c:248:60: error: unknown type name ‘GtkWidget’
make[2]: *** [xfce4_my_example_plugin-example.o] Error 1
make[2]: Leaving directory `/source/my_example_xfce/panel-plugin'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/source/my_example_xfce'
make: *** [all] Error 2
Below I pasted Makefile.am, configure.ac and panel-plugin/Makefile.am which are required for xfce4 xdt-autogen tool, which when run in the source directory will generate the appropriate make and configure files.
***************
* Makefile.am *
***************
SUBDIRS = \
panel-plugin \
po
AUTOMAKE_OPTIONS = \
1.8 \
dist-bzip2
*****************
* configure.ac *
*****************
dnl Version information
m4_define([my_example_version_major], [1])
m4_define([my_example_version_minor], [3])
m4_define([my_example_version_micro], [0])
m4_define([my_example_version], [my_example_version_major().my_example_version_minor().my_example_version_micro()])
dnl Initialize autoconf
AC_COPYRIGHT([Copyright (c) 2013
Example <bug#example.org>])
AC_INIT([xfce4-my_example-plugin], [my_example_version()], [bug#example.org])
AC_PREREQ([2.50])
dnl Initialize automake
AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
AM_CONFIG_HEADER([config.h])
AM_MAINTAINER_MODE()
dnl Check for basic programs
AC_PROG_CC()
AC_PROG_LD()
AC_PROG_INSTALL()
AC_PROG_INTLTOOL()
AC_PROG_LIBTOOL()
AM_PROG_CC_C_O()
dnl Check for standard headers
AC_HEADER_STDC()
AC_CHECK_HEADERS([string.h fcntl.h errno.h sys/socket.h netdb.h \
netinet/in.h sys/types.h time.h unistd.h stdio.h \
sys/stat.h stddef.h stdlib.h netinet/in.h])
dnl Check for i18n support
XDT_I18N([])
dnl Check for required packages
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.6.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.6.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.90.2])
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.3.90.2])
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.1])
dnl Check for debugging support
XDT_FEATURE_DEBUG()
AC_OUTPUT([
Makefile
po/Makefile.in
panel-plugin/Makefile
])
****************************
* panel-plugin/Makefile.am *
****************************
INCLUDES = \
-I$(top_srcdir) \
-DTHEMESDIR=\"$(datadir)/xfce4/my_example/icons\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
-DG_LOG_DOMAIN=\"my_example\"
plugin_PROGRAMS = \
xfce4-my_example-plugin
plugindir = $(libexecdir)/xfce4/panel-plugins
xfce4_my_example_plugin_SOURCES = \
my_example_dat.h \
my_example_func.h \
my_example_images.h \
my_example_applet.c \
my_example.c \
my_example_processdata.c \
my_example_menu.c
xfce4_my_example_plugin_CFLAGS = \
$(LIBXFCE4PANEL_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(GTK_CFLAGS)
xfce4_my_example_plugin_LDADD = \
$(LIBXFCE4PANEL_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS) \
$(GTK_LIBS)
desktopdir = $(datadir)/xfce4/panel-plugins
desktop_DATA = \
my_example.desktop
#INTLTOOL_DESKTOP_RULE#
EXTRA_DIST = \
my_example.desktop.in
CLEANFILES = \
$(desktop_DATA)
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
I do have the right header files included in my source files in addition the source files compile fine before making the xfce4 related changes.
Makefile.am
xfce4_my_example_plugin_SOURCES = \
example_dat.h \
example_func.h \
example_images.h \
example_applet.c \
example.c \
example_processdata.c \
example_menu.c
From example_applet.c which is the first source file entered. Originally I only had "xfce4_my_example_plugin_SOURCES = example_applet.c" since the rest would be found through that file. It gave the same error.
#include <gtk/gtk.h>
#include <glib-object.h>
#include <string.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4panel/xfce-hvbox.h>
#include "example_dat.h" /* contains all structures */
#include "example_func.h" /* contains all function prototypes used in this program */
#include "example_images.h"
#include "example.c"
#include "example_processdata.c"
#include "example_menu.c"
/* register the xfce plugin */
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(example_applet_fill);
It looks like I solved the problem. The build process for xfce is slightly different than what I am using to build the gnome panel applet.
For the gnome applet I use one source file to include all other source and header files.
In xfce it appears, after having looked over various plugin source trees, each source file includes the necessary headers, however none of the source files include other source files.
The fix was to not include any other source files at all and change each source file to include the header files.
I want to make m3u8-segmenter for Http Live Stream: https://github.com/johnf/m3u8-segmenter
There are errors when I make, the errors are:
gcc -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings -Werror m3u8-segmenter.c -o m3u8-segmenter -lavformat -lavcodec -lavutil
m3u8-segmenter.c: In function ‘add_output_stream’:
m3u8-segmenter.c:82:14: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:82:14: note: each undeclared identifier is reported only once for each function it appears in
m3u8-segmenter.c:94:14: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c: In function ‘main’:
m3u8-segmenter.c:338:5: error: ‘av_open_input_file’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1090) [-Werror=deprecated-declarations]
m3u8-segmenter.c:352:5: error: implicit declaration of function ‘guess_format’ [-Werror=implicit-function-declaration]
m3u8-segmenter.c:352:5: error: nested extern declaration of ‘guess_format’ [-Werror=nested-externs]
m3u8-segmenter.c:352:10: error: assignment makes pointer from integer without a cast [-Werror]
m3u8-segmenter.c:371:18: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function)
m3u8-segmenter.c:376:18: error: ‘CODEC_TYPE_AUDIO’ undeclared (first use in this function)
m3u8-segmenter.c:387:5: error: ‘av_set_parameters’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1434) [-Werror=deprecated-declarations]
m3u8-segmenter.c:392:5: error: ‘dump_format’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1559) [-Werror=deprecated-declarations]
m3u8-segmenter.c:406:5: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:411:5: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:444:67: error: ‘PKT_FLAG_KEY’ undeclared (first use in this function)
m3u8-segmenter.c:455:13: error: ‘put_flush_packet’ is deprecated (declared at /usr/local/include/libavformat/avio.h:293) [-Werror=deprecated-declarations]
m3u8-segmenter.c:456:13: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
m3u8-segmenter.c:476:13: error: ‘url_fopen’ is deprecated (declared at /usr/local/include/libavformat/avio.h:279) [-Werror=deprecated-declarations]
m3u8-segmenter.c:482:13: error: ‘av_write_header’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1492) [-Werror=deprecated-declarations]
m3u8-segmenter.c:514:5: error: ‘url_fclose’ is deprecated (declared at /usr/local/include/libavformat/avio.h:280) [-Werror=deprecated-declarations]
cc1: all warnings being treated as errors
make: *** [all] Error 1
You're getting those errors because for some reason, this block in libav_compat.h took effect:
/* Support older versions of ffmpeg and libav */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
#endif
But whichever headers are supposed to define CODEC_TYPE_AUDIO and CODEC_TYPE_VIDEO don't. From the comment there, it looks like you probably should update your other software (ffmpeg and/or libav) and then try again.