|
From: Horst R. <hr...@un...> - 2002-02-04 08:13:10
|
Hello and moin moin,
I have a seriously problem. The following code produced a linker error and
no code is build.
c:\dev\dev-c++\testproj\arrh.o(.bss+0x0)://c/dev/dev-c++/testproj/arrh.cpp:
multiple definition of `arh'
c:\dev\dev-c++\testproj\main.o(.bss+0x0)://c/dev/dev-c++/testproj/main.cpp:
first defined here
If i commented out the include, all is compiled fine. I does not understand
it. Can anyone help me ? Thanks in advance.
File:arrh.h
#ifndef arrh_H
#define arrh_H
[...]
class arrhenius
{
public:
arrhenius();
[...]
bool calc();
} arh;
File: main.cpp
#include <cstdlib>
#ifndef arrh_H
#include "arrh.h"
#endif
int main(int argc, char *argv[])
{
[...]
bool b = arh.calc();
[...]}
#endif
There are two other questions.
Last day I have integrated a win api referenz as winhelp into dev-c++. After
copy it in the help directory, it was automaticly integrated. Great !!
Now I seek such for C/C++ commands, a language reference. Any tip ?
Where can I find a list of changes between gcc 2.9.5.2 and gcc 2.9.5.3 ?
I could not find anything.
greetings
Horst
|
|
From: melchor m. o. <mel...@ho...> - 2006-10-25 18:59:19
|
Hello everyone: I am using Dev C++ to generate an .exe from a very simple c source code. When I try to generate de .exe I get the message: "gcc: -lobjc: linker input file unused since linking not done" In the compiler options I set the option "link an objective C program", so I dont know wahts going w´rong with the buliding process. I tried tó compile and link usin the command line on a dos shell but I dont find any help about the commands, neither within Dev C++ nor in the internet. When I compile i just get the .o file but no chance to get the .exe Who can help me out? _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ |
|
From: Ioannis V. <no...@ya...> - 2002-02-04 20:57:20
|
I did not see any member function implementations. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Horst Roessner > Sent: Monday, February 04, 2002 10:13 AM > To: dev...@li... > Subject: [Dev-C++] linking problem > > > Hello and moin moin, > > I have a seriously problem. The following code produced a > linker error and > no code is build. > > c:\dev\dev-c++\testproj\arrh.o(.bss+0x0)://c/dev/dev-c++/testp > roj/arrh.cpp: > multiple definition of `arh' > c:\dev\dev-c++\testproj\main.o(.bss+0x0)://c/dev/dev-c++/testp > roj/main.cpp: > first defined here > > If i commented out the include, all is compiled fine. I does > not understand > it. Can anyone help me ? Thanks in advance. > File:arrh.h #ifndef arrh_H #define arrh_H [...] class arrhenius { public: arrhenius(); [...] bool calc(); } arh; File: main.cpp #include <cstdlib> #ifndef arrh_H #include "arrh.h" #endif int main(int argc, char *argv[]) { [...] bool b = arh.calc(); [...]} #endif There are two other questions. Last day I have integrated a win api referenz as winhelp into dev-c++. After copy it in the help directory, it was automaticly integrated. Great !! Now I seek such for C/C++ commands, a language reference. Any tip ? Where can I find a list of changes between gcc 2.9.5.2 and gcc 2.9.5.3 ? I could not find anything. greetings Horst _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Horst R. <hr...@un...> - 2002-02-04 21:58:27
|
Hi Ioannis,
of course, there is one. I have the code truncated.
Here the first part of it.
[...]
arrhenius::arrhenius()
{
}
bool arrhenius::calc()
{
for (int i = 0; i < K; i++)
{
for (int j = 0; j < aN[i]; j++)
{
aSY[i] += aY[j][i];
aSSY[i] += sqr(aY[j][i]);
} // for j
aMean[i] = aSY[i] / zw.M;
zw.SY += aSY[i];
zw.SX += aN[i] * aX[i];
zw.SSX += aN[i] * sqr(aX[i]);
[...]
the code is very long. The project is just at the begin.
There are oly link errors but no compiler errors.
Horst
PS: from now I will write to the list from a new e-mail adress:
h.r...@gm.... This subscription will be closed. I subscribed today on
the new adress,
> Ioannis Vranos schreibt::
> I did not see any member function implementations.
>
> Ioannis
[...]
>> -----Original Message-----
>> Of Horst Roessner
>> Sent: Monday, February 04, 2002 10:13 AM
>> To: dev...@li...
>> Subject: [Dev-C++] linking problem
>>
>> Hello and moin moin,
>>
>> I have a seriously problem. The following code produced a
>> linker error and
>> no code is build.
>>
>> c:\dev\dev-c++\testproj\arrh.o(.bss+0x0)://c/dev/dev-c++/testp
>> roj/arrh.cpp:
>> multiple definition of `arh'
>> c:\dev\dev-c++\testproj\main.o(.bss+0x0)://c/dev/dev-c++/testp
>> roj/main.cpp:
>> first defined here
>>
>> If i commented out the include, all is compiled fine. I does
>> not understand
>> it. Can anyone help me ? Thanks in advance.
>>
> File:arrh.h
>
> #ifndef arrh_H
> #define arrh_H
>
> [...]
>
> class arrhenius
> {
> public:
> arrhenius();
> [...]
> bool calc();
> } arh;
>
>
> File: main.cpp
>
> #include <cstdlib>
> #ifndef arrh_H
> #include "arrh.h"
> #endif
>
> int main(int argc, char *argv[])
> {
> [...]
> bool b = arh.calc();
> [...]}
>
> #endif
>
>
> There are two other questions.
> Last day I have integrated a win api referenz as winhelp into dev-c++.
> After
> copy it in the help directory, it was automaticly integrated. Great !!
> Now I seek such for C/C++ commands, a language reference. Any tip ?
> Where can I find a list of changes between gcc 2.9.5.2 and gcc 2.9.5.3 ?
> I could not find anything.
>
> greetings
> Horst
|
|
From: Ioannis V. <no...@ya...> - 2002-02-05 03:30:55
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Horst Roessner
> Sent: Monday, February 04, 2002 11:58 PM
> To: dev...@li...
> Subject: [Dev-C++] Re: linking problem
>
>
> Hi Ioannis,
>
> of course, there is one. I have the code truncated.
> Here the first part of it.
>
> [...]
>
> arrhenius::arrhenius()
> {
> }
>
> bool arrhenius::calc()
> {
> for (int i = 0; i < K; i++)
> {
> for (int j = 0; j < aN[i]; j++)
> {
> aSY[i] += aY[j][i];
> aSSY[i] += sqr(aY[j][i]);
> } // for j
> aMean[i] = aSY[i] / zw.M;
> zw.SY += aSY[i];
> zw.SX += aN[i] * aX[i];
> zw.SSX += aN[i] * sqr(aX[i]);
> [...]
>
> the code is very long. The project is just at the begin.
> There are oly link errors but no compiler errors.
> Horst
You must include these definitions in the header file. Also you must
remove the #ifndef from your main.cpp.
I mean this:
#include <cstdlib>
#ifndef arrh_H
#include "arrh.h"
#endif
should become this:
#include <cstdlib>
Also remove the #endif from the main.cpp. The #ifndef #endif should be
placed in the header files only. I mean your header file should become:
#ifndef arrh_H
#define arrh_H
[...]
class arrhenius
{
public:
arrhenius();
[...]
bool calc();
} arh;
// Member function definitions here
#endif
No other macros in main.cpp. Also better choose longer name in the place
of arrh_H.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.d2g.com
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ya...> - 2002-02-05 03:44:31
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Ioannis Vranos
> Sent: Tuesday, February 05, 2002 5:30 AM
> To: Dev-C++
> Subject: RE: [Dev-C++] Re: linking problem
>
>
> You must include these definitions in the header file. Also
> you must remove the #ifndef from your main.cpp.
>
> I mean this:
>
> #include <cstdlib>
> #ifndef arrh_H
> #include "arrh.h"
> #endif
>
> should become this:
>
> #include <cstdlib>
>
>
> Also remove the #endif from the main.cpp. The #ifndef #endif
> should be placed in the header files only. I mean your header
> file should become:
>
>
> #ifndef arrh_H
> #define arrh_H
>
> [...]
>
> class arrhenius
> {
> public:
> arrhenius();
> [...]
> bool calc();
> } arh;
>
> // Member function definitions here
>
>
> #endif
>
>
> No other macros in main.cpp. Also better choose longer name
> in the place of arrh_H.
Also as Luigi Santillo said you should remove the object definition from
the header file and place it in the main.cpp. If you want a global
object, define it outside main().
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.d2g.com
* Alternative URL: http://run.to/noicys
|
|
From: Luigi S. <gi...@li...> - 2002-02-04 22:29:29
|
Hi, Horst
Here is my opinion about your link error, as for the other two things, I
don't have a solution.
Your code is placed in two files: one is "arrh.h" and the other is "main.cpp".
the former, as stated by its extension, is an header file, as a rule of
thumb, these files should contain declarations only.
For instance:
class arrhenius { ... };
In your case, you have:
class arrhenius { ... } arh;
You not only declared the class "arrhenius", but also defined the variable
"arh".
Since the language expects to find one definition for each variable, if you
include the header in two different source files, the linker will find two
definition for the same variable and will issue an error message.
I suggest you change your code as follows:
arrh.h
------------
#ifndef arrh_H
#define arrh_H
class arrhenius
{
...
};
#endif // not defined arrh_H
main.cpp
-------------
#include "arrh.h"
int
main()
{
...
arrhenius arh;
...
}
At 08:12 04/02/02 +0000, Horst Roessner wrote:
>Hello and moin moin,
>
>I have a seriously problem. The following code produced a linker error and
>no code is build.
>c:\dev\dev-c++\testproj\arrh.o(.bss+0x0)://c/dev/dev-c++/testproj/arrh.cpp:
>multiple definition of `arh'
>c:\dev\dev-c++\testproj\main.o(.bss+0x0)://c/dev/dev-c++/testproj/main.cpp:
>first defined here
>If i commented out the include, all is compiled fine. I does not
>understand it. Can anyone help me ? Thanks in advance.
>File:arrh.h
>#ifndef arrh_H
>#define arrh_H
>[...]
>class arrhenius
>{
>public:
>arrhenius();
>[...]
>bool calc();
>} arh;
>
>File: main.cpp
>#include <cstdlib>
>#ifndef arrh_H
>#include "arrh.h"
>#endif
>int main(int argc, char *argv[])
>{
>[...]
>bool b = arh.calc();
>[...]}
>#endif
>There are two other questions.
>Last day I have integrated a win api referenz as winhelp into dev-c++.
>After copy it in the help directory, it was automaticly integrated. Great !!
>Now I seek such for C/C++ commands, a language reference. Any tip ?
>Where can I find a list of changes between gcc 2.9.5.2 and gcc 2.9.5.3 ?
>I could not find anything.
>greetings
>Horst
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
--
Luigi
gi...@li...
|