I am trying to access Oracle database using OCILIB on Ubuntu.
I use that on the command line:
gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -L/u01/app/oracle/product/11.2.0/xe//lib -lclntsh -I$/home/user/Desktop/ocilib-4.3.1/include -locilib test.c -o con
But I am getting the following error:
test.c:(.text+0x20): undefined reference to `OCI_Initialize'
test.c:(.text+0x39): undefined reference to `OCI_ConnectionCreate'
test.c:(.text+0x49): undefined reference to `OCI_StatementCreate'
test.c:(.text+0x5e): undefined reference to `OCI_ExecuteStmt'
test.c:(.text+0x6a): undefined reference to `OCI_GetResultset'
test.c:(.text+0x81): undefined reference to `OCI_GetString'
test.c:(.text+0x95): undefined reference to `OCI_GetInt'
test.c:(.text+0xb5): undefined reference to `OCI_FetchNext'
test.c:(.text+0xbe): undefined reference to `OCI_Cleanup'
collect2: error: ld returned 1 exit status
You didn't link against ocilib library. Add -llibocilib to your command line.
Related
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?
gcc -I/opt/cplex-studio-125/cplex/include -lcplex -L/opt/cplex-studio-125/cplex/lib/x86-64_sles10_4.1/static_pic mipex1.c
I'm trying to compile an example from cplex. -I option is fine. The -L option seems to be corrupt, since it can't find the function names.
Where is the error? In the specifiec link there is a libcplex.a.
/tmp/ccf5sKky.o: In function `main':
mipex1.c:(.text+0x9f): undefined reference to `CPXopenCPLEX'
mipex1.c:(.text+0xee): undefined reference to `CPXgeterrorstring'
mipex1.c:(.text+0x125): undefined reference to `CPXsetintparam'
mipex1.c:(.text+0x222): undefined reference to `CPXcreateprob'
mipex1.c:(.text+0x2e1): undefined reference to `CPXcopylp'
mipex1.c:(.text+0x334): undefined reference to `CPXcopyctype'
mipex1.c:(.text+0x380): undefined reference to `CPXmipopt'
mipex1.c:(.text+0x3cc): undefined reference to `CPXgetstat'
mipex1.c:(.text+0x403): undefined reference to `CPXgetobjval'
mipex1.c:(.text+0x474): undefined reference to `CPXgetnumrows'
mipex1.c:(.text+0x490): undefined reference to `CPXgetnumcols'
mipex1.c:(.text+0x4be): undefined reference to `CPXgetx'
mipex1.c:(.text+0x51c): undefined reference to `CPXgetslack'
mipex1.c:(.text+0x5f9): undefined reference to `CPXwriteprob'
mipex1.c:(.text+0x64d): undefined reference to `CPXfreeprob'
mipex1.c:(.text+0x697): undefined reference to `CPXcloseCPLEX'
mipex1.c:(.text+0x6e3): undefined reference to `CPXgeterrorstring'
collect2: error: ld returned 1 exit status
The order of appearance of the library matters. Change your compilation statement to
gcc -I/opt/cplex-studio-125/cplex/include mipex1.c L/opt/cplex-studio-125/cplex/lib/x86-64_sles10_4.1/static_pic -lcplex
(Generic version)
gcc -I/<path> -L<path> <source.c> -l<lib>
to put the library after the source file, so that, linker will search the library for the function called from the source file.
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.
Which is the best way to compile libjpeg on a Windows machine? Should I use Microsoft Visual Studio or can I use something else like Cygwin?
Note: when I use Cygwin and copy makefile.vc to Makefile, jconfig.vc to jconfig.h and run this sample code: http://www.cim.mcgill.ca/~junaed/code/libjpeg_sample.tar.gz
then the compiler produces the following errors:
$ gcc main.c
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x5a): undefined reference to `jpeg_std_error'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x7e): undefined reference to `jpeg_CreateDecompress'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x93): undefined reference to `jpeg_stdio_src'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0xa9): undefined reference to `jpeg_read_header'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0xb7): undefined reference to `jpeg_start_decompress'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x11b): undefined reference to `jpeg_read_scanlines'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x178): undefined reference to `jpeg_finish_decompress'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x186): undefined reference to `jpeg_destroy_decompress'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x1f6): undefined reference to `jpeg_std_error'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x21a): undefined reference to `jpeg_CreateCompress'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x22f): undefined reference to `jpeg_stdio_dest'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x269): undefined reference to `jpeg_set_defaults'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x27f): undefined reference to `jpeg_start_compress'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x2c7): undefined reference to `jpeg_write_scanlines'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x2e5): undefined reference to `jpeg_finish_compress'
C:\cygwin\tmp\ccwChyeY.o:main.c:(.text+0x2f3): undefined reference to `jpeg_destroy_compress'
collect2.exe: error: ld returned 1 exit status
Well, if you just want the .dll it is already compiled.
https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libjpeg&arch=x86_64
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