Is there anything special about how MFC projects are handled?
Here is the script. I like to define member functions of a class in a file hinstead of breaking the class between two files.
In Visual Studio, I can create an empty Win32 project and do something like this:
main.cpp:
#include "doubleDef.h"
int main()
{
doubleDef t;
t.func();
return 0;
}
doubleDef.h:
#pragma once
class doubleDef
{
public:
int func();
};
int doubleDef::func()
{
return 4;
}
This is just great.
If I take the doubleDef.hMFC into the dialogue project and add it #include "doubleDef.h"to the hmain dialogue file , I will get LNK2005, saying that it is funcalready defined, which seems to be #pragma onceignored.
If I instead include doubleDef.hin the main dialog file cpp, everything is in order. But on an empty Win32, I can enable it doubleDef.h"several times" by doing the following:
header.h
#pragma once
#include "doubleDef.h"
Header1.h
#pragma once
#include "doubleDef.h"
main.cpp:
#include "Header.h"
#include "Header1.h"
int main()
{
doubleDef t;
t.func();
return 0;
}
, , #pragma once ( doubleDef::func()).
doubleDef , h. , func inline , ( int func() {return 4;}), h .
inline , , h inline.
?