Code Blocks: can i add the #include "stdafx.h"?

can i add the #include "stdafx.h" on Code Blocks?
using 'afx_msg' i can create functions for use the '::' on global section(correct me if i'm wrong):
afx_msg void OnDestroy();
"stdafx.h" is normally used by Visual Studio when you use pre-compiled headers.
afx_msg is used in MFC applications.
You can create a stdafx.h file in CodeBlocks and define afx_msg, however I am not sure what you actually want to do.
http://stackoverflow.com/questions/35320149/what-does-afx-msg-do-mfc
so maybe i'm thinking wrong on what i can do with it :(
but see these sample:
1
2
3
4
5
6
7
8
9
10
11
12
13
class testafx
{
    public: afx_msg void test()
    {
        MessageBox(NULL, "hello 1","hi", MB_OK);
    }
};

testafx a;
void a::test()
{
    MessageBox(NULL, "hello 1","hi", MB_OK);
}

now you see how i need to use it. unless i'm wrong on what i can do with 'afx_msg'.
like you see, the 'test' isn't declareted on 'a'. but i get these error:
"'a' is not a class, namespace, or enumeration"
Last edited on
Line 10 must be void testafx::test()
The behavior "test" belongs to the class of a type, not to an individual instance of that type.
In other words, the test function belongs to every testafx, not a.
Last edited on
"The behavior "test" belongs to the class of a type, not to an individual instance of that type."
so how can i make to an individual instance of that type without redefinition?
Topic archived. No new replies allowed.