'Why my variable rise link error? C++ LINK2005 [duplicate]

ini.h

#pragma once
extern int w = 800;

main.cpp

#include "ini.h"
int main()
{
 cout<<w;
}

Error: LNK2005 "int w" (?w@@3HA) уже определен в main.obj

what is problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source