我有3个文件Test.h,Test.cpp的和main.cpp中
Test.h
#ifndef Test_H
#define Test_H
namespace v
{
int g = 9;;
}
class namespce
{
public:
namespce(void);
public:
~namespce(void);
};
#endif
TEST.CPP
#include "Test.h"
namespce::namespce(void)
{
}
namespce::~namespce(void)
{
}
Main.cpp的
#include <iostream>
using namespace std;
#include "Test.h"
//#include "namespce.h"
int main ()
{
return 0;
}
建设期间,它提供了以下错误..
1>namespce.obj : error LNK2005: "int v::g" (?g@v@@3HA) already defined in main.obj
1>C:\Users\E543925\Documents\Visual Studio 2005\Projects\viku\Debug\viku.exe : fatal error LNK1169: one or more multiply defined symbols found
好心帮尽快..