Problems compiling the Shakespeare Programming Language? spl2c - c

For testing and fun purposes I downloaded the Shakespeare Programming language.
http://shakespearelang.sourceforge.net/
I tried to run the Makefile through make
and it spits out this result:
gcc grammar.tab.o scanner.o strutils.o -O2 -Wall -lfl -o spl2c
grammar.tab.o: In function `report_error':
grammar.tab.c:(.text+0x9): undefined reference to `yylineno'
grammar.tab.o: In function `report_warning':
grammar.tab.c:(.text+0x49): undefined reference to `yylineno'
grammar.tab.o: In function `yyparse':
grammar.tab.c:(.text+0x515): undefined reference to `yylex'
grammar.tab.c:(.text+0x682): undefined reference to `yylineno'
grammar.tab.c:(.text+0x708): undefined reference to `yylineno'
grammar.tab.c:(.text+0x7ce): undefined reference to `yylineno'
grammar.tab.c:(.text+0x882): undefined reference to `yylineno'
grammar.tab.c:(.text+0x8f6): undefined reference to `yylineno'
grammar.tab.o:grammar.tab.c:(.text+0x9aa): more undefined references to `yylineno' follow
collect2: error: ld returned 1 exit status
make: *** [spl2c] Error 1
Does anyone know what could be going wrong when trying to make?
I tried looking at this to resolve my issue but found nothing.

Related

ALSA Lib 1.1.2 Compilation error

I am trying to cross compile ALSA Lib application for linux-arm based processor. I am using eclipse to do the build for me. The build phase of the application is successful but I get errrors when the gcc linker tries to complete.
I get the following errors
Building target: sound
Invoking: Cross GCC Linker
arm-linux-gnueabihf-gcc -L/proc/asound -L/srv/nfs/rootfs/usr/lib -Wl,-rpath-link,/srv/nfs/rootfs/usr/lib -L/srv/nfs/rootfs/lib -Wl,-rpath-link,/srv/nfs/rootfs/lib -o "sound" ./play.o
./play.o: In function main':
/home/neonws/sound/Debug/../play.c:13: undefined reference tosnd_pcm_open'
makefile:29: recipe for target 'sound' failed
/home/neonws/sound/Debug/../play.c:14: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:20: undefined reference tosnd_pcm_hw_params_malloc'
/home/neonws/sound/Debug/../play.c:21: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:26: undefined reference tosnd_pcm_hw_params_any'
/home/neonws/sound/Debug/../play.c:27: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:32: undefined reference tosnd_pcm_hw_params_set_access'
/home/neonws/sound/Debug/../play.c:33: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:38: undefined reference tosnd_pcm_hw_params_set_format'
/home/neonws/sound/Debug/../play.c:39: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:44: undefined reference tosnd_pcm_hw_params_set_rate_near'
/home/neonws/sound/Debug/../play.c:45: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:50: undefined reference tosnd_pcm_hw_params_set_channels'
/home/neonws/sound/Debug/../play.c:51: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:56: undefined reference tosnd_pcm_hw_params'
/home/neonws/sound/Debug/../play.c:57: undefined reference to snd_strerror'
/home/neonws/sound/Debug/../play.c:62: undefined reference tosnd_pcm_hw_params_free'
/home/neonws/sound/Debug/../play.c:64: undefined reference to snd_pcm_prepare'
/home/neonws/sound/Debug/../play.c:65: undefined reference tosnd_strerror'
/home/neonws/sound/Debug/../play.c:71: undefined reference to snd_pcm_writei'
/home/neonws/sound/Debug/../play.c:72: undefined reference tosnd_strerror'
/home/neonws/sound/Debug/../play.c:78: undefined reference to `snd_pcm_close'
collect2: error: ld returned 1 exit status
make: *** [sound] Error 1
11:15:58 Build Finished (took 75ms)
I am using the Sample Playback Program from ASLA-LIB api.
I am wondering what is causing the linker to fail?
You're missing an asound library linkage, add -lasound to your linking flags (see this question which tells where to do that properly in Eclipse). And probably remove -L/proc/asound, I don't think you have your libraries there.

Eclipse MinGW undefined reference to SDL functions

So I've been searching for nigh on two hours now, haven't found a single working solution. I'm using SDL 2.0.4, and all the libraries are for the x64 architecture. I don't get the errors with SDL v1, but I need some of the newer functions. Here's what's coming up:
Info: Internal Builder is used for build
gcc -o Winchester.exe "src\\Winchester.o" -lmingw32 -lSDL2
src\Winchester.o: In function `SDL_main':
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:17: undefined reference to `SDL_Init'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:20: undefined reference to `SDL_CreateWindow'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:22: undefined reference to `SDL_Quit'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:26: undefined reference to `SDL_CreateRenderer'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:28: undefined reference to `SDL_DestroyWindow'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:29: undefined reference to `SDL_Quit'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:36: undefined reference to `SDL_PollEvent'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:39: undefined reference to `SDL_DestroyRenderer'
C:\Users\inigo\workspace\Winchester\Debug/../src/Winchester.c:40: undefined reference to `SDL_DestroyWindow'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o):(.text.startup+0xa7): undefined reference to `WinMain#16'
collect2.exe: error: ld returned 1 exit status
Any help?

undefined reference to...while make install in ubuntu 12.04LTS precise

tony#tony-HP-2000-Notebook-PC:~$ cd '/home/tony/Desktop/run-privexec'
tony#tony-HP-2000-Notebook-PC:~/Desktop/run-privexec$ make install
mkdir -p build build/obj
gcc -lcap -lecryptfs build/obj/main.o build/obj/privexec.o build/obj/utils.o build/obj/perms.o -o build/privexec
build/obj/privexec.o: In function `insert_key':
privexec.c:(.text+0x7df): undefined reference to `ecryptfs_add_passphrase_key_to_keyring'
build/obj/privexec.o: In function `remove_key':
privexec.c:(.text+0xdcb): undefined reference to `ecryptfs_remove_auth_tok_from_keyring'
build/obj/perms.o: In function `drop_privileges':
perms.c:(.text+0x73): undefined reference to `cap_get_proc'
perms.c:(.text+0x9d): undefined reference to `cap_set_flag'
perms.c:(.text+0xa5): undefined reference to `cap_set_proc'
perms.c:(.text+0xad): undefined reference to `cap_free'
build/obj/perms.o: In function `raise_privileges':
perms.c:(.text+0x125): undefined reference to `cap_get_proc'
perms.c:(.text+0x14f): undefined reference to `cap_set_flag'
perms.c:(.text+0x157): undefined reference to `cap_set_proc'
perms.c:(.text+0x15f): undefined reference to `cap_free'
collect2: ld returned 1 exit status
make: *** [privexec] Error 1
Your Makefile produces this command:
gcc -lcap -lecryptfs build/obj/main.o ...
which is incorrect. It should be:
gcc build/obj/main.o ... -lcap -lecryptfs
The order of object files and libraries on the link line matters. You can read here or here to understand why it does.

hiredis "undefined reference to" compiler error

I want to compile the client for redis in C. I've downloaded and installed the libevent library and the hiredis files. I've used this command:
gcc -I/home/tasos/Dropbox/lists/hiredis example-libevent.c -levent
but I get these errors:
/tmp/ccxoerYJ.o: In function `redisLibeventReadEvent':
example-libevent.c:(.text+0x28): undefined reference to `redisAsyncHandleRead'
/tmp/ccxoerYJ.o: In function `redisLibeventWriteEvent':
example-libevent.c:(.text+0x56): undefined reference to `redisAsyncHandleWrite'
/tmp/ccxoerYJ.o: In function `getCallback':
example-libevent.c:(.text+0x2d2): undefined reference to `redisAsyncDisconnect'
/tmp/ccxoerYJ.o: In function `main':
example-libevent.c:(.text+0x393): undefined reference to `redisAsyncConnect'
example-libevent.c:(.text+0x3f3): undefined reference to `redisAsyncSetConnectCallback'
example-libevent.c:(.text+0x404): undefined reference to `redisAsyncSetDisconnectCallback'
example-libevent.c:(.text+0x45d): undefined reference to `redisAsyncCommand'
example-libevent.c:(.text+0x47d): undefined reference to `redisAsyncCommand'
collect2: ld returned 1 exit status
why isn't this working?
Use -levent and -lhiredis compile option in command.

Compilation error in GCC on Linux

I am trying to compile my code for GnuTLS, but on compiling it gives the following errors.
I have checked gnutls.h is present on my system in /usr/include/gnutls/.
What else can be the cause?
gcc -o tls.o tls.c
/tmp/ccfyZ1Bd.o: In function `main':
tls.c:(.text+0x1c): undefined reference to `gnutls_global_init'
tls.c:(.text+0x28): undefined reference to `gnutls_anon_allocate_client_credentials'
tls.c:(.text+0x3c): undefined reference to `gnutls_init'
tls.c:(.text+0x58): undefined reference to `gnutls_priority_set_direct'
tls.c:(.text+0x74): undefined reference to `gnutls_credentials_set'
tls.c:(.text+0x79): undefined reference to `tcp_connect'
tls.c:(.text+0x91): undefined reference to `gnutls_transport_set_ptr'
tls.c:(.text+0x9d): undefined reference to `gnutls_handshake'
tls.c:(.text+0xdc): undefined reference to `gnutls_perror'
tls.c:(.text+0x109): undefined reference to `gnutls_record_send'
tls.c:(.text+0x125): undefined reference to `gnutls_record_recv'
tls.c:(.text+0x154): undefined reference to `gnutls_strerror'
tls.c:(.text+0x1e6): undefined reference to `gnutls_bye'
tls.c:(.text+0x1f2): undefined reference to `tcp_close'
tls.c:(.text+0x1fe): undefined reference to `gnutls_deinit'
tls.c:(.text+0x20a): undefined reference to `gnutls_anon_free_client_credentials'
tls.c:(.text+0x20f): undefined reference to `gnutls_global_deinit'
collect2: ld returned 1 exit status
This is a linking error. You need to include some library with the -l flag. Taking a wild guess without knowing your setup, I would try -lgnutls

Resources