error C2374: 'i' : redefinition; multiple initialization
防范式头文件
test.h
#ifndef __TEST__
#define __TEST__
int i = 100;
#endifmain.cpp#include “stdafx.h”
#include “test.h”
#include “test.h”C++写法:
test.h
#pragma once
int i = 100;在main.cpp第二次处理#include
原创
2016-10-25 23:12:02 ·
3850 阅读 ·
0 评论