| | |
fatal error LNK1169
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2009
Posts: 8
Reputation:
Solved Threads: 0
Hi,
I have a code and I want to add a .cpp file that I made and use the functions that I've done in that .cpp file. So at this project I am adding the ekf.cpp file and then included....but I get this errors.
1>Linking...
1>ekf.obj : error LNK2005: "void __cdecl copymatrix(int (* const)[2],int (* const)[2],int)" (?copymatrix@@YAXQAY01H0H@Z) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: _main already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double u_err" (?u_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double m_err" (?m_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double dim" (?dim@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double angle" (?angle@@3NA) already defined in I90ControllerDlg.obj
1>.\Debug/I90Controller.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Creating browse information file...
what is the problem? If I will not add to the project the ekf.cpp file then I will receive a error that the ekf.cpp can not be opened no such file or directory.
I have a code and I want to add a .cpp file that I made and use the functions that I've done in that .cpp file. So at this project I am adding the ekf.cpp file and then included....but I get this errors.
1>Linking...
1>ekf.obj : error LNK2005: "void __cdecl copymatrix(int (* const)[2],int (* const)[2],int)" (?copymatrix@@YAXQAY01H0H@Z) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: _main already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double u_err" (?u_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double m_err" (?m_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double dim" (?dim@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double angle" (?angle@@3NA) already defined in I90ControllerDlg.obj
1>.\Debug/I90Controller.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Creating browse information file...
what is the problem? If I will not add to the project the ekf.cpp file then I will receive a error that the ekf.cpp can not be opened no such file or directory.
•
•
Join Date: Jan 2009
Posts: 8
Reputation:
Solved Threads: 0
I did and now is the same error
1>Generating Code...
1>Linking...
1>ekf.obj : error LNK2005: "double u_err" (?u_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double m_err" (?m_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double dim" (?dim@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double angle" (?angle@@3NA) already defined in I90ControllerDlg.obj
1>.\Debug/I90Controller.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 8.00.50727
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\Documents and Settings\ogvalent\Desktop\VCw\VCw\Debug\BuildLog.htm"
1>I90Controller - 5 error(s), 16 warning(s
1>Generating Code...
1>Linking...
1>ekf.obj : error LNK2005: "double u_err" (?u_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double m_err" (?m_err@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double dim" (?dim@@3NA) already defined in I90ControllerDlg.obj
1>ekf.obj : error LNK2005: "double angle" (?angle@@3NA) already defined in I90ControllerDlg.obj
1>.\Debug/I90Controller.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 8.00.50727
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\Documents and Settings\ogvalent\Desktop\VCw\VCw\Debug\BuildLog.htm"
1>I90Controller - 5 error(s), 16 warning(s
It appear you are declaring the same object in two *.cpp files. That will happen if you declare something in a header file then include that header file in all *.cpp files. What you need to do to corect that is declare it with the extern keyword in the header file, then on only ONE of the *.cpp files declare it again without extern
C++ Syntax (Toggle Plain Text)
// header file named myheder.h (or whatever name you want to give it) extern double u_err;
C++ Syntax (Toggle Plain Text)
#include <myheader.h> // one of the *.cpp files double u_err = 0.0;
Last edited by Ancient Dragon; Jan 16th, 2009 at 7:20 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Help whit this error LNK1169 (C++)
- cAn some one help me and explain why this error occurs (C++)
- fatal error LNK1169: one or more multiply defined symbols found. (C++)
- Error LNK2005 (C++)
- SQLCA Error (Oracle)
- "already defined" error (C++)
- get werid error when splitting up my code (C++)
Other Threads in the C++ Forum
- Previous Thread: Simple File i/o Problem
- Next Thread: expected ‘,’ or ‘...’ before numeric constant
Views: 1130 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






