static member

I

Ian Collins

Jim said:
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.cpp(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.
 
J

Jim Langston

Jim said:
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.cpp(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
 
J

Jim Langston

(e-mail address removed)
Jim Langston said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top