Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > static member

Reply
Thread Tools

static member

 
 
Jim Johnson
Guest
Posts: n/a
 
      04-09-2008
why following source file complied with error

http://www.oniva.com/upload/1356/ThreadX.cpp
http://www.oniva.com/upload/1356/ThreadX.h
http://www.oniva.com/upload/1356/Main.cpp

1>d:\c_htp\multithreading\part1listing1\threadx.cp p(15) : error C2724:
'ThreadX::ThreadStaticEntryPoint' : 'static' should not be used on
member functions defined at file scope

how to fix it?
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      04-09-2008
Jim Johnson wrote:
> why following source file complied with error
>
> http://www.oniva.com/upload/1356/ThreadX.cpp
> http://www.oniva.com/upload/1356/ThreadX.h
> http://www.oniva.com/upload/1356/Main.cpp
>
> 1>d:\c_htp\multithreading\part1listing1\threadx.cp p(15) : error C2724:
> 'ThreadX::ThreadStaticEntryPoint' : 'static' should not be used on
> member functions defined at file scope
>
> how to fix it?


Remove the keyword static?

It's not a good idea to post links (people using virus prone OSs are
unlikely to open them), you should post a minimal, compilable example.

--
Ian Collins.
 
Reply With Quote
 
 
 
 
Jim Langston
Guest
Posts: n/a
 
      04-09-2008
Jim Johnson wrote:
> why following source file complied with error
>
> http://www.oniva.com/upload/1356/ThreadX.cpp
> http://www.oniva.com/upload/1356/ThreadX.h
> http://www.oniva.com/upload/1356/Main.cpp
>
> 1>d:\c_htp\multithreading\part1listing1\threadx.cp p(15) : error C2724:
> 'ThreadX::ThreadStaticEntryPoint' : 'static' should not be used on
> member functions defined at file scope
>
> how to fix it?


This is a Microsoft error. Inside MSVC in the help click on Index and type
in C2724 and read the full explanation.

Compiler Error C2724'identifier' : 'static' should not be used on member
functions defined at file scope

Static member functions should be declared with external linkage. Static
member functions at file scope cause an error under ANSI compatibility (/Za)
and a warning under Microsoft extensions (/Ze).

Example

// C2724.cpp
class C
{
static void func();
};

static void C::func(){}; // C2724




--
Jim Langston



 
Reply With Quote
 
Jim Langston
Guest
Posts: n/a
 
      04-09-2008

"Jim Langston" <> wrote in message
news:5I_Kj.2917$...
> Jim Johnson wrote:
>> why following source file complied with error
>>
>> http://www.oniva.com/upload/1356/ThreadX.cpp
>> http://www.oniva.com/upload/1356/ThreadX.h
>> http://www.oniva.com/upload/1356/Main.cpp
>>
>> 1>d:\c_htp\multithreading\part1listing1\threadx.cp p(15) : error C2724:
>> 'ThreadX::ThreadStaticEntryPoint' : 'static' should not be used on
>> member functions defined at file scope
>>
>> how to fix it?

>
> This is a Microsoft error. Inside MSVC in the help click on Index and
> type in C2724 and read the full explanation.


I meant to say that C2724 was a Microsoft error code. The error would occur
in other compilers too. I thought I should explain that.

> --
> Jim Langston
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can a static member function access non-static member? dolphin C++ 3 12-05-2007 12:39 PM
How do you call a regular member function from a static member function? aling C++ 6 10-30-2005 04:38 AM
Can Derived class static member access protected member from base class? Siemel Naran C++ 4 01-12-2005 06:46 PM
How would I use qsort to sort a struct with a char* member and a long member - I want to sort in order of the long member Angus Comber C Programming 7 02-05-2004 06:41 PM
performance of static member function vs. instance member function 0to60 C++ 4 11-21-2003 05:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57