473,396 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

multiple definition error in linker

1
Hi,
I am trying to set up a cardiac simulator using CVODE package.

I have a integrator.cpp file where I set up all the parameters to call the CVODe package.

The file compiles just fine, but when I try to build it it crashed with a multiple definition error on all the functions and variables defined in the file.

This problem is portable from VC++ to cygwwin g++

here is the error in VC++:


integrator.obj : error LNK2005: "public: void __thiscall CDFNCell::CVode_run(double,double * const)" (?CVode_run@CDFNCell@@QAEXNQAN@Z) already defined in cardiacsimulator.obj
integrator.obj : error LNK2005: _func_f already defined in cardiacsimulator.obj
integrator.obj : error LNK2005: "public: void __thiscall CDFNCell::CVode_f(int,double,struct _generic_N_Vector *,struct _generic_N_Vector *,void *)" (?CVode_f@CDFNCell@@QAEXHNPAU_generic_N_Vector@@0P AX@Z) already defined in cardiacsimulator.obj
.......

Please help!

Thx
Oct 5 '06 #1
2 4368
Banfa
9,065 Expert Mod 8TB
integrator.obj : error LNK2005: "public: void __thiscall CDFNCell::CVode_run(double,double * const)" (?CVode_run@CDFNCell@@QAEXNQAN@Z) already defined in cardiacsimulator.obj
integrator.obj : error LNK2005: _func_f already defined in cardiacsimulator.obj
integrator.obj : error LNK2005: "public: void __thiscall CDFNCell::CVode_f(int,double,struct _generic_N_Vector *,struct _generic_N_Vector *,void *)" (?CVode_f@CDFNCell@@QAEXHNPAU_generic_N_Vector@@0P AX@Z) already defined in cardiacsimulator.obj
These errors are actually telling what the problem is.

The first 3 lines are saying

The function CDFNCell::CVode_run(double,double * const) which is defined in integrator.obj (presumably compiled from integrator.cpp) is already defined (i.e. already exists) in cardiacsimulator.obj (presumably compiled from cardiacsimulator.cpp).

i.e. you have implemented the function twice once in each file

The second 3 lines say the same thing about CDFNCell::CVode_f(int,double,struct _generic_N_Vector *,struct _generic_N_Vector *,void *)


Generally speaking it is a good idea to only implement the functions of your program once per program :D
Oct 5 '06 #2
If your func is not implemented at multiple places. Then check if it is not inline and defined in a .h file which is included by both integrator.cc and cardiacsimulator.cc.
Either the func should be inline or defined in a .cc file.
Aug 31 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Georg Teichtmeister | last post by:
Hello! We are developing a math - library for realtime applications and want to use some given mathlibraries as base(ipp, MTL, .. ). Our library is a wrapper for those and you should be able to...
7
by: Ittay Dror | last post by:
Hi I have this peculiar situation. I have a library of utility classes, which I use to compile a binary. I want to reimplement a method in class. The class is only a collection of static...
3
by: Robert Mens | last post by:
Hi, My compiler/linker gives me the strangest error: process.o(.text+0x0): In function `login_user_login': : multiple definition of `login_user_login' login.o(.text+0x0): first defined here...
9
by: lbj137 | last post by:
I have two files: A.c and B.c. In both files I define a global variable, int xxxx; When I compile with a green hills compiler (and also i think with a GNU compiler) I get no errors or warnings....
1
by: Yogesh | last post by:
Hi all, I am using gcc 4.0 with Xcode 2.2 on Mac OS 10.4.3. I am using two static lib's in my project, which in turn include zlib. I get "multiple definition of symbol" Linker error. While...
4
by: pavan734 | last post by:
Hello I have one .h file which I have includeded completely under #ifndef followed by #define guards. I have the member function definitions in the same .h file only. Still Iam getting linker...
11
by: lars.uffmann | last post by:
Easily described problem: Using g++ version 3.3.5 under suse 9.3, bla.h: ----------- #ifndef myTEST #define myTEST ZFSInt test; #endif
10
by: subramanian100in | last post by:
Suppose I declare a global variable int g; in two different files say a.c which has main() and b.c When I compile them to build an executable under gcc in Redhat Linux with the command ...
8
by: subramanian100in | last post by:
Suppose I have #include <stdio.h> #include <string.h> size_t strlen(const char *str) { printf("from strlen - %s\n", str); return 0; // return some dummy value
6
by: The Architect | last post by:
Hi, If I have the same symbol in the .data section of 2 obj files, LD gives a multiple declaration error on linking? Would like to know the reason for this (diab only issues a warning) Also...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.