Hi,
I was declaring a function as extern in one of my module, but I was
not declaring it anywhere. I am still not getting any linking error.
Is it my Compiler deficiency?
Thanks,
|
|
0
|
|
|
|
Reply
|
Tagore
|
7/23/2010 12:21:47 AM |
|
On 07/23/10 12:21 PM, Tagore wrote:
> Hi,
>
> I was declaring a function as extern in one of my module, but I was
> not declaring it anywhere. I am still not getting any linking error.
Are you calling it?
--
Ian Collins
|
|
0
|
|
|
|
Reply
|
Ian
|
7/23/2010 12:24:05 AM
|
|
No, I am not calling it, but intend to call it later.
On Jul 23, 5:24=A0am, Ian Collins <ian-n...@hotmail.com> wrote:
> On 07/23/10 12:21 PM, Tagore wrote:
>
> > Hi,
>
> > I was declaring a function as extern in one of my module, but I was
> > not declaring it anywhere. I am still not getting any linking error.
>
> Are you calling it?
>
> --
> Ian Collins
|
|
0
|
|
|
|
Reply
|
Tagore
|
7/23/2010 12:27:21 AM
|
|
On 07/23/10 12:27 PM, Tagore wrote:
[please don't top-post]
> On Jul 23, 5:24 am, Ian Collins<ian-n...@hotmail.com> wrote:
>> On 07/23/10 12:21 PM, Tagore wrote:
>>
>>> I was declaring a function as extern in one of my module, but I was
>>> not declaring it anywhere. I am still not getting any linking error.
>>
>> Are you calling it?
>>
> No, I am not calling it, but intend to call it later.
Well then, there's nothing to complain about until you do!
--
Ian Collins
|
|
0
|
|
|
|
Reply
|
Ian
|
7/23/2010 12:56:48 AM
|
|
On 23 Jul., 02:21, Tagore wrote:
>
> I was declaring a function as extern in one of my module, but I was
> not declaring it anywhere.
You mean "not _defining_ it anywhere."
struct foo; // <-- declaration (incomplete type)
struct foo { int j; }; // <-- definition
int bar(int a, int b); // <-- declaration
int bar(int a, int b) { // <-- definition
return a+b;
}
Make sure you understand the difference.
Cheers!
SG
|
|
0
|
|
|
|
Reply
|
Sebastian
|
7/23/2010 12:11:58 PM
|
|
Tagore wrote:
> I was declaring a function as extern in one of my module, but I was
> not declaring it anywhere. I am still not getting any linking error.
Huh? Did you mean "not defining it anywhere"?
> Is it my Compiler deficiency?
No. The definition is only required when the function is _used_ in an
expression. If it is not used, there's no requirement to define it.
--
Best regards,
Andrey Tarasevich
|
|
0
|
|
|
|
Reply
|
Andrey
|
7/23/2010 6:11:36 PM
|
|
Sebastian <s.gesemann@gmail.com> writes:
> On 23 Jul., 02:21, Tagore wrote:
>>
>> I was declaring a function as extern in one of my module, but I was
>> not declaring it anywhere.
>
> You mean "not _defining_ it anywhere."
>
> struct foo; // <-- declaration (incomplete type)
> struct foo { int j; }; // <-- definition
Actually that's debatable. The syntax for the whole thing ({}s and all)
is a "struct-declaration" and some of the examples in the standard say
things like:
After the further declaration:
struct ss { int n; };
I'd say its not wrong to call it either. Definitions always act as
declarations (at least I can't think of a case where they don't) and
the above does define a structure in the ordinary English sense of the
word.
>
> int bar(int a, int b); // <-- declaration
> int bar(int a, int b) { // <-- definition
> return a+b;
> }
It's worth bearing in mind that the function definition also acts as a
declaration of it (and in this case, both are serve as prototypes as
well).
<snip>
--
Ben.
|
|
0
|
|
|
|
Reply
|
Ben
|
7/23/2010 7:01:17 PM
|
|
On 23 Jul., 21:01, Ben Bacarisse wrote:
> Sebastian <s.gesem...@gmail.com> writes:
> > On 23 Jul., 02:21, Tagore wrote:
>
> >> I was declaring a function as extern in one of my module, but I was
> >> not declaring it anywhere.
>
> > You mean "not _defining_ it anywhere."
>
> > =A0 struct foo; =A0 =A0 =A0 =A0 =A0 =A0 // <-- declaration (incomplete =
type)
> > =A0 struct foo { int j; }; =A0// <-- definition
>
> Actually that's debatable. =A0The syntax for the whole thing ({}s and
> all) is a "struct-declaration" and some of the examples in the
> standard say things like:
>
> =A0 After the further declaration:
> =A0 =A0 =A0 struct ss { int n; };
>
> I'd say its not wrong to call it either. =A0Definitions always act as
> declarations (at least I can't think of a case where they don't) and
> the above does define a structure in the ordinary English sense of
> the word.
Seems like this is another case where the C++ terminology differs from
the C terminology.
Cheers!
SG
|
|
0
|
|
|
|
Reply
|
s.gesemann (661)
|
7/26/2010 9:27:51 AM
|
|
|
7 Replies
430 Views
(page loaded in 0.148 seconds)
Similiar Articles: function declared, but not defined - comp.lang.cOn 23 Jul., 02:21, Tagore wrote: > > I was declaring a function as extern in one of my module, but I was > not declaring it anywhere. You mean "not _defining_ it ... Error using ==> fprintf Function is not defined for 'sym' inputs ...function declared, but not defined - comp.lang.c Error using ==> fprintf Function is not defined for 'sym ... Error using ==> fprintf Function is not defined for 'sym ... loadlibrary - function not found - comp.soft-sys.matlabfunction declared, but not defined - comp.lang.c loadlibrary - function not found - comp.soft-sys.matlab... the errors: Warning: The function 'maintDLL' was not ... > The ... FFT Not Defined for Double - comp.soft-sys.matlabfunction declared, but not defined - comp.lang.c What would cause static function 'double round(double,int)' declared but not defined - answer - I have a CPP file in my ... Compile error: User-defined type not defined - comp.databases.ms ...function declared, but not defined - comp.lang.c I am still not getting any linking error. Is i... ... I am still not getting any linking error. Function definitions are not permitted in this context. - comp ...function declared, but not defined - comp.lang.c Function definitions are not permitted in this context. - comp ... function declared, but not defined - comp.lang.c ... Linking error in calling sbrk() function - comp.lang.c++.moderated ...function declared, but not defined - comp.lang.c I am still not getting any linking error. Is ... I am still not getting any linking error. Are you calling it? ... Function definitions are not permitted in this context - comp.soft ...function declared, but not defined - comp.lang.c... return a+b; > } It's worth bearing in mind that the function definition also ... point to beta.introduce, but will not ... Solution to "cannot instantiate abstract class due to following ...... see declaration of 'C' testcpp.cpp(43) : warning C4259: 'void __thiscall A::setNumber(int) const' : pure virtual function was not defined testcpp.cpp(9) : see declaration ... extern typedef struct - comp.lang.cThis will already trip up the compiler since 'object' is not declared, defined or ... For that it may not be within a function (otherwise it wouldn't be global). error C2129: declare but not define - Microsoft Corporation ...But now i'm getting this error error C2129: static function 'unsigned char dtqueueEnqueue(gen_queue *,msg_pckt)' declared but not defined c ... function declared, but not defined - comp.lang.c | Computer GroupOn 23 Jul., 02:21, Tagore wrote: > > I was declaring a function as extern in one of my module, but I was > not declaring it anywhere. You mean "not _defining_ it ... 7/25/2012 12:41:50 AM
|