Gcc Compile Error Undefined Reference To
Contents |
Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct Ubuntu Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC undefined reference to in c Support AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter Useful Links Distrowatch
Gcc Undefined Reference To Function
Bugs: Ubuntu PPAs: Ubuntu Web Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login
Undefined Reference To G++
Advanced Search Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] compiling with gcc and "undefined reference to xxx" Having an Issue With Posting ? Do you want
How To Solve Undefined Reference Error In C
to help us debug the posting issues ? < is the place to report it, thanks ! Results 1 to 4 of 4 Thread: compiling with gcc and "undefined reference to xxx" Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode February 14th, 2011 #1 NeillHog View Profile View Forum Posts Private Message Visit Homepage Gee! undefined reference to a function c++ These Aren't Roasted! Join Date Jul 2007 Location The Bavarian Alps Beans 129 DistroKubuntu 7.10 Gutsy Gibbon compiling with gcc and "undefined reference to xxx" I have run up against a wall. I really appreciate any and all help because I am so out of my depth. I have installed gcc on a NSLU2. Running gcc -o test test.c brings no error and afterwards I can run the program test with ./test. test.c #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and undefined reference c++ policies of this site About Us Learn more about Stack Overflow the company c undefined reference to function in header file Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users c undefined reference to pthread_create Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a https://ubuntuforums.org/showthread.php?t=1687827 minute: Sign up Compilation error: Undefined reference to up vote 1 down vote favorite I'm working on a C program for getting events from Udev. The program has been compiled and tested on a host running Debian (With GCC 4.7.2-5). Recently, switched to Ubuntu 12.04 LTS (With GCC 4.6.3). The same program fails to compile and halts during the linking phase. http://stackoverflow.com/questions/27168739/compilation-error-undefined-reference-to automounter_main.c:(.text+0xd4e): undefined reference to `udev_new' automounter_main.c:(.text+0xe02): undefined reference to `udev_device_new_from_devnum' automounter_main.c:(.text+0xeb0): undefined reference to `udev_device_new_from_syspath' automounter_main.c:(.text+0xf63): undefined reference to `udev_device_get_sysattr_list_entry' automounter_main.c:(.text+0xf77): undefined reference to `udev_list_entry_get_name' automounter_main.c:(.text+0xf85): undefined reference to `udev_device_get_sysattr_value' automounter_main.c:(.text+0x100a): undefined reference to `udev_device_get_sysattr_value' automounter_main.c:(.text+0x1055): undefined reference to `udev_device_get_sysattr_value' automounter_main.c:(.text+0x1078): undefined reference to `udev_list_entry_get_next' automounter_main.c:(.text+0x108c): undefined reference to `udev_device_get_parent' automounter_main.c:(.text+0x1118): undefined reference to `udev_device_unref' automounter_main.c:(.text+0x1122): undefined reference to `udev_unref' The following steps were taken, but nothing seems to work. Install all packages related to udev (udev, libudev-dev, libudev0). All the packages are reported to be the latest. Create a Symlink in /usr/lib pointing the correct udev library. Upgraded libc package Symlink was verified using: $ ls -l libudev* lrwxrwxrwx 1 root root 39 Nov 27 15:57 libudev.so -> /lib/x86_64-linux-gnu/libudev.so.0.13.0) Kindly help me find a way to resolve this error. Thanks in advance. gcc ubuntu-12.04 udev share|improve this question edited Nov 28 '14 at 12:21 asked Nov 27 '14 at 10:47 Girish 113111 1 Obviously the linker fails to link some udev library. Check (or post here) your linker command and whether the right library is provided with -l and/or -L. &n
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow http://stackoverflow.com/questions/11233078/undefined-reference-gcc the company Business Learn more about hiring developers or posting ads with us Stack Overflow http://stackoverflow.com/questions/12272864/linker-error-on-linux-undefined-reference-to Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Undefined reference gcc up vote 3 down vote favorite When I try to compile my program on ubuntu using undefined reference gcc, i get these errors: main.c:(.text+0x162): undefined reference to json_parse' main.c:(.text+0x182): undefined reference tojson_value_free' However, these functions are included in a file called json.h, which I import in main.c and which I include in my gcc command. Anyone got a clue? c gcc ubuntu compilation share|improve this question asked Jun 27 '12 at 18:49 Thomas K 3,42232551 add a comment| 1 Answer 1 active oldest votes up vote 6 down vote accepted undefined reference to You should not compile the "json.h" header. The undefined reference is not a compiler error, it's a linker error. It means you have either not compiled the file containing json_value_free to your code, or haven't linked to the library containing it. You should do either action instead of trying to compile the header file itself. So, if you have a separate json.c file, you have to compile and link it also to your main.c file. Try (I assume GCC): gcc -o myprog main.c json.c share|improve this answer edited Jun 27 '12 at 18:59 answered Jun 27 '12 at 18:51 user529758 Sorry, I think I didn't make myself clear: I'm trying to compile main.c. The thing is, that the json.h file is not in a library. It's just an .h (and .c) file that I import and include.. –Thomas K Jun 27 '12 at 18:58 I understand. See my further explanation. –user529758 Jun 27 '12 at 18:59 That's it! Thanks! (Can and will accept your answer in four minutes) –Thomas K Jun 27 '12 at 19:00 Thank you! I'm glad I could help you out. –user529758 Jun 27 '12 at 19:04 @ThomasK So could you please do it? Thanks alot. –user529758 Jun 27 '12 at 19:13 ad
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Linker error on Linux: “undefined reference to” up vote 10 down vote favorite 1 I am able to make a shared library without problems. I create libcbitcoin.so (with no errors) and attempt to link against it with an executable as well as OpenSSL libraries. I use this command: gcc -L/media/sf_BitEagle_Projects/cbitcoin/build/bin -lcbitcoin \ -Wl-rpath,/media/sf_BitEagle_Projects/cbitcoin/build/bin -lssl -lcrypto \ -L/usr/local/ssl/lib/ -o /media/sf_BitEagle_Projects/cbitcoin/build/bin/testCBAddress \ /media/sf_BitEagle_Projects/cbitcoin/build/obj/testCBAddress.o \ /media/sf_BitEagle_Projects/cbitcoin/build/obj/CBOpenSSLCrypto.o The bin directory is the location of the library. The obj directory has the object files I wish to link into an executable. In the command I use the -L, -l and -rpath options which I thought was all that is needed for linking in linux. It seems I am wrong since I get errors like: /media/sf_BitEagle_Projects/cbitcoin/test/testCBAddress.c:40: undefined reference to `CBNewByteArrayFromString' CBNewByteArrayFromString is found in the library. For some reason it is not being linked. OpenSSL too: /media/sf_BitEagle_Projects/cbitcoin/dependencies/crypto/CBOpenSSLCrypto.c:37: undefined reference to `SHA1' How do I get the linking to work? GCC version: gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 On Linux Mint 13 Thank you. linux gcc build linker share|improve this question edited Sep 5 '12 at 0:19 choroba 106k1089146 asked Sep 5 '12 at 0:01 Matthew Mitchell 1,48764789 Are you sure you want to hard-wire the /media