473,383 Members | 1,821 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,383 software developers and data experts.

About to commit suicide - Linker error

1
Hi,

I must have hit my head real hard sometime these days as after starting to use a redhat 9 machine I cannot link a stupid c++ project. I've spent 3 days googling down to results page 20 and used severeal other search engines. I am desperate!

Any help highly appreciated:

Expand|Select|Wrap|Line Numbers
  1.  cfg.cpp: 
  2. #include <iostream>
  3. #include "Cfg.h"
  4.  
  5. Cfg::Cfg()
  6. {
  7.     int i=0;
  8. }
  9. -------------
  10. Cfg.h:
  11. #ifndef CFG_H
  12. #define CFG_H
  13.  
  14. class Cfg
  15. {
  16. public:
  17.  
  18.     Cfg();
  19.  
  20. };
  21.  
  22. #endif
  23. -------------
  24. DAO.cpp:
  25. #include "Cfg.h"
  26. #include "DAO.h"
  27. using namespace std;
  28.  
  29. DAO::DAO( )
  30. {
  31.     int i=0;
  32. }
  33. -------------
  34. DAO.h:
  35. #ifndef DAO_H
  36. #define DAO_H
  37.  
  38. #include "Cfg.h"
  39. class DAO
  40. {
  41. public:
  42.  
  43.     explicit DAO();
  44.  
  45. };
  46.  
  47. #endif
  48. -------------
  49. DBHelper.cpp:
  50. #include "Cfg.h"
  51. #include "DAO.h"
  52. #include "DBHelper.h"
  53. using namespace std;
  54.  
  55. DBHelper::DBHelper()
  56. {
  57.     int i=0;
  58. }
  59. ---------------
  60. DBHelper.h
  61. #ifndef DBHELPER_H
  62. #define DBHELPER_H
  63.  
  64. #include "Cfg.h"
  65. using namespace std;
  66.  
  67. class DBHelper
  68. {
  69. public:
  70.  
  71.     explicit DBHelper();
  72.  
  73. };
  74.  
  75. #endif
  76. -----------------
  77. proba.c
  78. #include <iostream>
  79. using namespace std;
  80. #include "DAO.cpp"
  81.  
  82. int main (void)
  83. {
  84. cout<<"Hello world";
  85. }
  86.  
  87. -----------------
  88.  
This is madness for me:

- g++ -c fileX.cpp: Each file produces it's .o without problems
- 'g++ -o proba DAO.o Cfg.o DBHelper.o proba.o' produces:

Expand|Select|Wrap|Line Numbers
  1.  [cc] 0 total files to be compiled. 
  2. [cc] Starting link
  3. [cc] bin/proba.o(.text+0x0): In function `DAO::DAO[not-in-charge]()':
  4. [cc] /home/bereng/probaLinker/lib/DAO.cpp:6: multiple definition of `DAO::DAO[not-in-charge]()'
  5. [cc] bin/lib/DAO.o(.text+0x0):/home/bereng/probaLinker/lib/DAO.cpp:6: first defined here
  6. [cc] bin/proba.o(.text+0x10): In function `DAO::DAO[in-charge]()':
  7. [cc] /home/bereng/probaLinker/lib/DAO.cpp:6: multiple definition of `DAO::DAO[in-charge]()'
  8. [cc] bin/lib/DAO.o(.text+0x10):/home/bereng/probaLinker/lib/DAO.cpp:6: first defined here
  9. [cc] collect2: ld returned 1 exit status
  10.  
HELP! PLEASE!
Apr 20 '06 #1
1 2556
Banfa
9,065 Expert Mod 8TB
In proba.cpp

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. using namespace std;
  3. #include "DAO.cpp"
  4.  
surely that should be

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. using namespace std;
  3. #include "DAO.h"
  4.  
Apr 20 '06 #2

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

Similar topics

11
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to...
4
by: Old Wolf | last post by:
I have the following code. One one compiler it compiles OK, on the other it gives the two warnings shown below, and then the linker fails because Foo<int>::str is undefined. Which is correct? ...
2
by: janet | last post by:
HI, I had a question on auto-commit in DB2 EEE V8 on AIX V5. Here is my example.. there are two script A.sh , B.SQL A.sh is following:
7
by: Ugrasena via DBMonster.com | last post by:
Hi team i am using DB2 7.2 on Windows2000. We have lot many SQL Procedure Calls, is there any way i can Turn off the Auto Commit on that Database, the Problem i have is many of our Application...
5
by: Pradnyesh Rane | last post by:
Hi, I am encountering the following linker error on VC7. LINK : fatal error LNK1171: unable to load ole32.dll This error is only encountered for the "Debug" configuration. The project...
9
by: Peter Oliphant | last post by:
For some reson my code is generating a LNK1215 error, which 'suggests' I re-install VS C++. So I did. which did NOT solve the problem. The weid part is it seems to be caused by my one CPP file, but...
0
by: 42601551 | last post by:
in Jeff Partch's thread http://groups.google.com/group/microsoft.public.vc.language/browse_thread/thread/b9468ebbf7927da8/a901653d04ad774a%23a901653d04ad774a?sa=X&oi=groupsr&start=1&num=3 says a...
1
by: Felix | last post by:
After porting a project from VC6 to VC.NET 2003 I have a very strange problem generating link error 1104 for import libraries. I just ported the project and made some small adaptions so it fits...
4
by: yOtA | last post by:
I get this Linker Errors while compiling my program: Error: Unresolved external 'vminit()' referenced from C:\TESTE\TESTE.OBJ Error: Unresolved external 'vmalloc(void *, int, unsigned int,...
1
by: Deepath G | last post by:
This is deepath.. I am getting some linker error when i am trying to connect Websphere MQ using Borland C++ Builder 2006 using imqi.hpp on windows. Error Message ----------------------- ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.