Programming :: G++ Linking Error With Multiple Libs
Jan 9, 2011
I tried to link my executable program with 2 static libraries using g++. The 2 static libraries have the same function name. I'm expecting a "multiple definition" linking error from the linker, but I did not received.
Code:
//staticLibA.h
#ifndef _STATIC_LIBA_HEADER
#define _STATIC_LIBA_HEADER
int hello(void);
[code]....
View 4 Replies
ADVERTISEMENT
Oct 20, 2010
I'm trying to change a group of cpp files to one shared lib. I have created a shared lib with a single file. I then did this with a group of files. The difference in what I'm doing is that before with the single file, .a, was added into a single .o file. Now I'm trying to add it to my main.cpp file which is NOT a .o file. I'm now getting these compiler errors from the main.cpp where is doesn't seem to recognize the semaphores.Example Error: undefined reference to `sem_wait'If I were not to use the share libs this compiles and runs as I expected it to.Something tells me this is a compiler flag issue, at least I hope it is
View 1 Replies
View Related
Mar 13, 2011
compiling and linking using gcc: What does a file name with a suffix '.a' represent? If I have multiple .c and .h files, how can I link them together? How can I create the .a file?
View 6 Replies
View Related
Dec 17, 2009
I have 3 c++ files, classdef.h (header file with class definition), methods.cpp (class methods) and program.cpp - the program itself. Both .cpp files have
Code:
#include "classdef.h"
in files. How I can link the files together and compile them in one executable program? I am using Geany IDE for coding.
View 4 Replies
View Related
Apr 18, 2010
I have written an OpenGL based program which uses i.a. libjpeg that I want to link statically so I can send it to someone who doesn't have all the libraries needed installed to allow for a dynamically linked executable to run. As such I tried with giving the [b]-static[b] parameter to gcc.
Code:
x86_1$ make
gcc -O3 -c jpegloader.c
gcc --std=c99 -O3 -c --std=c99 -I/usr/include -L/usr/X11R6/lib main.c
[code].....
Why would gcc claim that I'm missing GLUT? This works perfectly fine when I do dynamic linking -- i.e. omitting the -static argument.
View 13 Replies
View Related
Jun 10, 2010
There's a problem with static linking (and no problems with dynamic linking).
Here's my code:
Quote:
And makefile rule:
Quote:
That's dynamic linking. And it works perfectly. If i use static linking
Quote:
There is an undefined reference error:
Quote:
As nm shows there's a symbol named BuzzerInit in static library.
View 2 Replies
View Related
May 30, 2010
So the above is the error message I am receiving when trying to compile (at make stage when error received) binutils 2.20.1. I am compiling in Virtualbox and the base machine is SourceMage 64bit.
View 4 Replies
View Related
May 6, 2010
[root@shankar-lx src1]# make
gcc -c main.c
gcc -c database.c
gcc -c e_sqlite.c
gcc -o TEST main.o database.o e_sqlite.o /usr/local/lib/libsqlite3.so.0.8.6 -w -lpthread
[root@shankar-lx src1]# ./TEST
./TEST: error while loading shared libraries: /usr/lib/libsqlite3.so.0: ELF file OS ABI invalid
My application compiled well but when try to run, it is giving ELF file OS ABI invalid ERROR. What is this error.
Kernel version is 2.4-18
View 1 Replies
View Related
Apr 13, 2011
I am creating two shared libs that i intend to be dynamically linkable in C and C++, cross platform Linux/Windows/Mac. As a basic sketch, true for both libs, the lib code is in several .c/.cpp and .h files. For now, I'll talk about the part that I am actively working on, a lib named Discover, i.e. libdiscover.so.1.0. First, everything is in a namespace, RemKon_Discover.
The main Discover.cpp defines the methods for the Discover class (declared in Discover.h) and has extern "C' routines that can return pointers to my main c++ object. The call to GetLibraryMainPointer() creates a Discover class object, theMainObject (ok, I win a prize for dumb names) and returns the (non-mangled) pointer to the caller over in my test program. The Discover class itself is declared extern "c" and the tester program #includes "Discover.h".
In the test program, dlopen() correctly opens the lib and dlsym() gets the pointer to theMainObject. However, when I use that pointer in the tester program to access a method (aDiscoverObject->hello(), e.g.) I get compile time errors saying that Discover::hello() in an undefined reference. My makefile is attached.
[Code]....
View 10 Replies
View Related
Jul 14, 2009
I have a wide area network with 7 CentOS servers running Bind and 1 Windows 2003 server. All 8 of these servers handle DHCP and DNS at their respective locations. At each site I can ping computer.site.company I'd like to be able to resolve the dns names from site to site. So from site1 I would like to be able to ping computer.site2.company and get a response.
View 4 Replies
View Related
Apr 11, 2011
I have 5 FTP users that upload files (and subdirectories) in their home directory, i need to mirror theese directories beetween them and with a "master" directory (accessible from a 6th user). Files can contain spaces or others special caracters. All the files are in the same filesystem, and i want to use hard link because i don't want to waste 5 time the space of a single file. I tried with find but i cannot handle spaces in it.
View 1 Replies
View Related
Apr 14, 2011
I need to cross-compile some libs for using in a ARM11 board running Linux (at this time, 2.6.28, but I'll try update it... and for costs reason, maybe it turns on a ARM9 board). The libs are libfprint, libusb-1.0 (that is a requirement of libfprint), libSDL (and some of its extensions) and maybe libsqlite3. How I can make this, with the development files in the host machine (an Ubuntu 10.04 32bits machine) and the runtime files at the host ARM11 Board.
View 6 Replies
View Related
Jul 23, 2009
Last night I was updating my system and I ran into some dependency errors. It seems like gecko-libs is having problems. here are my yum update results.
Code:
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package epiphany.i586 0:2.26.3-1.fc11 set to be updated
---> Package firefox.i586 0:3.5.1-1.fc11 set to be updated
--> Processing Dependency: gecko-libs = 1.9.1 for package: epiphany-2.26.3-1.fc11.i586
---> Package xulrunner.i586 0:1.9.1.1-1.fc11 set to be updated
---> Package yelp.i586 0:2.26.0-5.fc11 set to be updated
--> Finished Dependency Resolution
epiphany-2.26.3-1.fc11.i586 from updates has depsolving problems
--> Missing Dependency: gecko-libs = 1.9.1 is needed by package epiphany-2.26.3-1.fc11.i586 (updates)
Error: Missing Dependency: gecko-libs = 1.9.1 is needed by package epiphany-2.26.3-1.fc11.i586 (updates)
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
Code:
sudo rpm -qa|grep yum
yum-3.2.23-3.fc11.noarch
yum-metadata-parser-1.1.2-12.fc11.i586
anaconda-yum-plugins-1.0-4.fc11.noarch
yum-utils-1.1.22-1.fc11.noarch
PackageKit-yum-0.4.8-2.fc11.i586
PackageKit-yum-plugin-0.4.8-2.fc11.i586
yumex-2.0.5-6.fc11.noarch
View 14 Replies
View Related
Sep 23, 2010
I have some issue with QT in ubuntu , almost all QT application I cant use now. If I use Q4wine:
q4wine: symbol lookup error: /usr/lib/libQtSql.so.4: undefined symbol: _ZN14QObjectPrivate15checkWindowRoleEv
If KGet
q4wine: symbol lookup error: /usr/lib/libQtSql.so.4: undefined symbol: _ZN14QObjectPrivate15checkWindowRoleEv
SMPlayer
smplayer: symbol lookup error: smplayer: undefined symbol: _ZN9QListData7detach3Ev
Like all my QT applications is facing problem, How I can reinstall the qt libs? I am using ubuntu 10.04.
View 2 Replies
View Related
Apr 29, 2010
I have a C code and assembly (nasm) code and I am not able to find how to link them each other. Here are the codes :
NASM side:
Code:
global_maxofthree
section .text
_maxofthree:
[code]....
I am using ubuntu 9.10 and my NASM version 2.05.01 compiled on Nov 5 2008.
View 4 Replies
View Related
Feb 14, 2011
I untared a few libs on the wrong server (that's the when you're supposed to start laughing!) and I corrupted my server. Everytime it boots up, I get the following error:
/sbin/init: relocation error: /lib/tls/libc.so.6: symbol _dl_out_of_memory, version GLIBC_PRIVATE not defined in file ld-linux.so.2 with link time reference. Kernel panic - not syncing. Attempted to kill init!
I can I restore the original libs? I'm running RHEL 2.6.9-42 on a Proliant DL585.
View 6 Replies
View Related
Apr 11, 2010
This is probably a really stupid thing to ask considering the development I'm doing (effectivly creating a virus scanner), but how do I link classes/cpp files?I have 3 applications/sections that I can compile/combine with a makefile, that's fine, but I need them to run 1, 2, 3 once the output from the makefile is done.Currently the only section to actually run is whichever I have "main" in and obviously if I put that into all three, they won't compile as one.I've been looking all over the place at all sorts, header files and such, but there is no mention of how toually do this although I'm sure it must be possible. I'm used to being able to do this in Java and I'm sure I've seen C++ applications do it, but not worked out how.I have 3x .cpp files which are combined into one using a makefile:
Code:
# Virus Scanner
scanner.out : ProgramList.o MD5Hash.o HazardCheck.o
[code]...
View 2 Replies
View Related
Dec 11, 2010
I am trying to build an application that must link with python so as to load a python module during runtime.I have this makefile :
Code:
[alex@iskandhar src]$ cat Makefile
CFLAGS = -Wall -O3 -I ../../../SPOOLES.2.2 -DARCH="Linux" -DSPOOLES -DARPACK
[code]....
View 4 Replies
View Related
Oct 5, 2010
I have a really simple program trying to use XInput2.h, which fails on linking
Code:
#include <X11/extensions/XInput2.h>
int main(){
Display *XSession = XOpenDisplay(NULL);
int OriginScreen = 0;
int pID = 7;
[Code]....
I'm at a loss about what to do. Replacing XIWarpPointer by XWarpPointer and removing the pID argument solves it, but is not an option (no input ID).
View 5 Replies
View Related
Apr 13, 2011
I want to update my Red Hat using yum. So i got this kind of error:
Code:
--> Processing Dependency: libdb.so.2 for package: gnome-libs
--> Processing Dependency: libdb.so.2(GLIBC_2.0) for package: gnome-libs
--> Processing Conflict: yum conflicts yum-rhn-plugin < 0.5.3-30.el5
--> Finished Dependency Resolution
Error: Missing Dependency: libdb.so.2(GLIBC_2.0) is needed by package gnome-libs
Error: Missing Dependency: libdb.so.2 is needed by package gnome-libs
Error: yum conflicts with yum-rhn-plugin < 0.5.3-30.el5
What it mean? How to fix it? It stop my update.
View 4 Replies
View Related
May 27, 2010
I am trying to add some function to the c++ project (calling function) and the called function are in C. And i am getting error "undefined reference to "Hello(int,int)" " while linking. It is compiling correctly. It is linking to header file mention in the calling function. This header file has definition to the c - called function. Do you thinking having c files into C++ project will be a problem? Should I remove <stdio.h> in c files?
View 2 Replies
View Related
Oct 28, 2010
I have a question about shared objects and when mapping and linking is established in the following code...Well more of a verification.
getsetx.c - shared object source code Code: unsigned long x = 0;
unsigned long getx(void)
{
return x;
}
[Code].....
Now its my understanding when I execute ./testit, getsetx.so will get mapped into its address space at start up and testit will link any functions as they are needed..
View 3 Replies
View Related
Jan 22, 2011
I have set up Eclipse + CDT on an Arch 2010.05 install. I set up an eclipse project and added SDL as a dependency (see below):
Project -> Properties
* -> GCC C++ Compiler -> Preprocessor -> main=SDL_main
* -> GCC C++ Linker -> Libraries -> SDLmain SDL (in that order top to bottom)
* -> GCC C++ Linker -> Libraries -> Library Search Path -> /usr/lib/ (I verified that libSDL.a and libSDLmain.a are there)
This is the code I'm compiling. It's designed to just be a hello world style SDL app to see that everything is working.
[Code]...
View 3 Replies
View Related
Jan 18, 2011
Why do I still get mutiple definition of "_my_variable" error even after I used the #ifndef preprocessor in my hpp file?
This is my scenario
I have:
1. A.cpp (including X.hpp)
2. B.cpp (including X.hpp)
3. X.hpp
[Code]...
View 4 Replies
View Related
Apr 13, 2010
Today i download cheops source code and when i type ./configure returns me this error :
Quote:
checking for gnome-config... no checking for gnomeConf.sh file in /usr/local/lib... not found configure: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install Is there any way to install cheops in KDE ? Do you know any solution for this problem ?
View 9 Replies
View Related
Feb 10, 2011
I would like to ask you something about open-source and linux. Is it possible to make a commercial application for linux and sell it compiling it with linking to open-source libraries without altering them and consequently without allowing download of the source code and without making the application itself free?
View 3 Replies
View Related
Feb 17, 2010
I am using Centos 5.4 with gcc v4.1.2. If I take a bunch of .o files and I then link with my main.o to form an executable then this links and executes just fine. If however, I try to create an archive file (.a) using 'ar rus xxx.o yyy.o etc' and then try to link the resulting .a with my main.o then I get 'undefined symbol' linker errors and I don't understand why.
View 2 Replies
View Related
Apr 16, 2009
I received my dedicated server, and I was thrilled to work on it! After a while I encountered many, many problems, and most of them are fixed now.
However, I've been stuck on a LUA problem for hours now...When I check all files (/reconfigure) I get this error;
View 13 Replies
View Related
May 2, 2011
how I can resolve this error in compiling?
Linking testkeys... /usr/lib/gcc/i586-suse-linux/4.5/../../../../i586-suse-linux/bin/ld: cannot find -lSDL_ttf collect2: ld returned 1 exit status make: *** [testkeys] Error 1
View 3 Replies
View Related
Mar 24, 2010
The issue I am currently facing is more of an annoyance / curiosity, and it may not even be a problem, but it sure feels like one. Background: I am becoming a computational chemist (grad school begins in the fall) and the code I run is all in fortran. I am currently compiling with gfortran. When I compile the code (on a box running ubuntu server), everything appears to compile fine, but the linking stage is taking five to ten minutes. I ran the time command while making it and got the following results.
Quote:
time make
gfortran -c -O3 -fomit-frame-pointer -finline-functions -ffast-math suijtab.f
Linking testCompile ...
done
[code]...
I just don't understand why it is taking 5 minutes of real time if it only takes 10 - 15 sec of system time?
View 4 Replies
View Related