static member

Discussion in 'C++' started by Jim Johnson, Apr 9, 2008.

  1. Jim Johnson

    Jim Johnson Guest

    Jim Johnson, Apr 9, 2008
    #1
    1. Advertising

  2. Jim Johnson

    Ian Collins Guest

    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.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.

    --
    Ian Collins.
    Ian Collins, Apr 9, 2008
    #2
    1. Advertising

  3. Jim Johnson

    Jim Langston Guest

    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.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




    --
    Jim Langston
    Jim Langston, Apr 9, 2008
    #3
  4. Jim Johnson

    Jim Langston Guest


    "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.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.


    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
    >
    >
    Jim Langston, Apr 9, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. 0to60
    Replies:
    4
    Views:
    511
    jeffc
    Nov 21, 2003
  2. Siemel Naran
    Replies:
    4
    Views:
    801
    Micah Cowan
    Jan 12, 2005
  3. aling
    Replies:
    6
    Views:
    478
    Xiaobin.Huang
    Oct 30, 2005
  4. dolphin
    Replies:
    3
    Views:
    1,337
    Pete Becker
    Dec 5, 2007
  5. paul
    Replies:
    8
    Views:
    706
    Alf P. Steinbach
    Apr 30, 2009
Loading...

Share This Page