Programming :: Linking And Compiling Multiple C++ Files Into One Executable Program?

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


#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


Programming :: Compiling And Linking Multiple Files Using Gcc?

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

Programming :: Linking Of Fortran Executable Taking Exorbitant Amounts Of Time?

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.


time make
gfortran -c -O3 -fomit-frame-pointer -finline-functions -ffast-math suijtab.f
Linking testCompile ...


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

Programming :: SDL + Eclipse + CDT Compiling But Not Linking With G++ On Arch?

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.


View 3 Replies View Related

Programming :: C++: Compiling Multiple Source Files (with Templates Involved)?

Mar 21, 2011


anisha@linux-uitj:~/junk> ls -R
include src
template0.h template0.h~ template0.h.gch


View 11 Replies View Related

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.


int hello(void);


View 4 Replies View Related

Programming :: Script To Pass Multiple Files To Program?

Feb 8, 2011

I'm playing around with a bash script to pass files to a program (such as VLC). I thought something like this would work:

vlc $( ls | sed 's/ /\ /g' | tr '
' ' ' )

ls shows the files in the current directory, then sed changes spaces to " " (to escape them) and finally tr removes the line breaks. I end up changing:

01 - Music Track.mp3
02 - Another Track.mp3

01 - Music Track.mp3 02 - Another Track.mp3

"vlc 01 - Music Track.mp3 02 - Another Track.mp3" works if I type it manually but my script reports a problem with `-'

It seems it's not escaping the spaces.

View 4 Replies View Related

Programming :: Run Multiple Instances Of A Jar Executable?

May 5, 2009

It is possible to run multiple instances of a jar executable. Is it possible that only a single instance of the jar runs? Wrappers like JSmooth or Launch4J can be made to run as a single instance. But since there are no such wrappers for linux, I need a way to restrict the jar to a single instance. How to embed the jar file into an executable such it runs a single instance?

View 14 Replies View Related

Programming :: C++Linking Classes/.cpp Files To Run One After Other?

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:

# Virus Scanner
scanner.out : ProgramList.o MD5Hash.o HazardCheck.o


View 2 Replies View Related

Programming :: Static Linking Versus Dynamic Linking

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.


x86_1$ make
gcc -O3 -c jpegloader.c
gcc --std=c99 -O3 -c --std=c99 -I/usr/include -L/usr/X11R6/lib main.c


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

Programming :: Undefined Symbols When Linking A With Main O Files

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

Programming :: Meaning Of Compiling A Program?

Aug 17, 2010

I have been using gcc to compile C programs.
I want to know what exactly is the meaning of Compiling a C program.
I checked
cc -S prog.c
will give an .S file and if you analyze the hexdump I saw some assembly instructions.
So what does the compiler do which is not required in case of interpreted languages?

View 13 Replies View Related

Programming :: Compiling A C++ Program Using G++ With X86 Settings On X86_64?

Jan 25, 2010

How can I compile a C++ application using g++ with x86 platform settings on a x86_64 machine ? What are the possible negative side-effects of compiling a C++ application with x86 settings on a x86_64 platform ?

View 6 Replies View Related

Programming :: Compiling Libusb C++ Program To Run Without It's Dependencies?

Aug 6, 2010

I've built a piece of hardware that communicates using usb. I was wondering could I make a libusb based program run on it's own without gcc/ libusb

View 10 Replies View Related

Programming :: Compiling C Program For HPUX On IA/PA 64 Bits?

May 17, 2011

I had developed a C program on linux (x86). Now I need to port it to HP-UX OS on IA/PA 64 bit arch. What are the options to be used with cc compiler, on linux (x86), so that this could be done, if at all.

View 1 Replies View Related

Programming :: Error Compiling C++ Program Using C Library

May 8, 2010

I've created 3 files: swap.h and swap.c then make static library from it


Then I write 2 program to test this library: test_swap.c and test_swap.cpp

I compile


What's wrong with this in C++? And how can I make a library that can work both for any C and C++ program?

Here the source code




View 2 Replies View Related

Programming :: G++ Fails Compiling New Program / Make It Possible?

Jul 16, 2009

I am trying to compile systemc. Configuration is done OK and Makefiles are created. As soon as the "make" command i issue, recursively reaches the "utils" directory, errors are produced -declaration and include errors.

The files referenced by the errors DO exist and i hava managed to give g++ "-I ${LD_INCLUDE_PATH}, ie the variable, where all header dirs are listed. Libraries and compilers for gcc3.3 and g++3.3, i believe, are installed OK. code...

View 4 Replies View Related

Fedora :: F11 X86_64 Eduke Compile Error: Failed Linking Executable Eduke32!

Aug 6, 2010

trying to build Eduke32 from source but I receive the following error:


[priit@T16 eduke32]$ make
Build started using "gcc -fomit-frame-pointer -funswitch-loops -O2 -fno-stack-protector -W -Wall -Wimplicit -Werror-implicit-function-declaration -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -Isource -Ibuild/include -Isource/jmact -Isource/jaudiolib


View 2 Replies View Related

Programming :: Linking Object Files With Geany On Ubuntu - Undefined Reference To Class::functionName

Mar 9, 2009

I have created a simple test class - Mortgage, with the class declaration in the .h file and the class's methods defined in the .cpp file. (mortgage.h && mortgage.cpp, respectively) Straight up C++ 101 as far as I can tell. I instantiate the class in the main() function, which is defined in practice.cpp. Using Geany on Ubuntu, both the practice.o and mortgage.o files are created, but then I get a linker error: undefined reference to class::functionName

I get it for each function. If the mortgage.cpp file is foremost in the editor when I click "build", then I get the undefined reference to main() error, if practice.cpp is foremost (where the main() function is) then I get undefined reference to Mortgage::Mortgage(), and all the rest of the functions defined for that class. How do I get the linker to know where my object files are so it will link them in? Or is the problem somewhere else entirely?

View 8 Replies View Related

Programming :: Compiling A C++ Program Including Libpq-fe.h Using Cygwin

Sep 16, 2010

Compiling a C++ program including libpq-fe.h by the command Code: g++ -I/usr/include -L/lib -lpq my_program.cpp for access to a PostgreSQL database results in the error Code: undefined reference to '_PQconnectdb'

View 4 Replies View Related

Programming :: Error With Compiling Program 'can Not Be Used When Making Shared Object'

Oct 14, 2010

I've got an error with compiling a program: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib/python2.5/config/libpython2.5.a: could not read symbols: Bad value collect2: ld a retourn 1 code dtat d'excution make[2]: *** [bindings/] Erreur 1.

View 1 Replies View Related

Software :: Compiling Code - Linking To Libraries Using Different Versions Of C++ Runtime?

May 19, 2011

Basically, I'm trying to compile program A, which depends on LibA and LibB. LibA would not build with my version of G++ 4.4.3 due to a bug, so I've compiled the latest G++ 4.5 (installed in /opt directory) and built that library successfully (also installed in /opt).

I have LibB on my system already, but it was built with the 4.4.3 version. When compiling my final program, am I going to have issues because the .so files were built with different versions of gcc/g++? Or should I just rebuild a special version of LibB with the later version of the compiler just for that program? I can proceed and just see what happens, but I'm a little confused about how things work in a situation like this.

View 2 Replies View Related

Programming :: (.text+0x7): Undefined Reference - Compiling Program Include One Header File And 2 C

May 21, 2011

i am a new programer in c i have write a simple app and i have a problem with combiling my program include one header file and 2 c

void f();
void f(){

View 6 Replies View Related

Ubuntu :: Inbuilt Logging System - Ran And Installation - Program Opened Automatically - Can't Find Program Executable

Feb 23, 2011

I was wondering whether there is an inbuilt logging system in UNIX?

I ran and installation and the program opened up automatically but I can't find the program executable.

If I could find a log then I could locate this file.

View 9 Replies View Related

Networking :: Linking DNS From Multiple Servers?

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 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 and get a response.

View 4 Replies View Related

General :: Gcc Compiler Is Not Compiling Old C Programming Files Because Of Timestamp?

Nov 20, 2010

I am using makefile to complile all C Programming files. But certain files are not getting compiled and hence its object file is not getting generated. This is happening due to files haven't been modified for a long time. It seems that compiler knows that its object file is there hence no need to complie it actually it is not.

View 14 Replies View Related

OpenSUSE :: Program That Will Take Multiple Avi Files And Join Them Into One File?

Nov 6, 2010

I am looking for a program that will take multiple avi files and join them into one file

View 8 Replies View Related

General :: Compiling Programs - Steps For Producing Executable

Oct 19, 2010

I'm trying to get my head around compiling programs, and need some things clarified. Can anyone confirm or deny my understanding so far:

1) Program is written in high level language, such as C. File(s) of the program are the 'source code'.
2) Program is then 'compiled' to turn it into low-level code that is both hardware - i.e. Intel/AMD/ARM processor specific, and also Linux distribution specific. This resulting files are called the binaries.
3) I can go from source code to installed and usable program by doing these steps:
make install

View 6 Replies View Related

Programming :: Same Program Runs Multiple Times But Get Very Different Results?

Dec 7, 2010

I used wait4 to time a child process. but the results differ each other dramatically. why?my core source code lists as the point: in linux 2.6 kernel, how to time a process with a high precision. and, only its user-time rather than the elapsed time???

static struct rusage ruse;
static pid_t u_pid;
int main(int argc, char *argv[])
int i;

View 14 Replies View Related

General :: Bash - Mirroring Of Multiple Directories - Hard Linking

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

Copyrights 2005-15, All rights reserved