前景提要
HDC调试需求开发(15万预算),能者速来!>>>
main.cpp
#include <iostream> using namespace std; #include "testcpp.h" int main() { int q = AddCpp(1, 2); q++; #if __cplusplus cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!! #endif return 0; }
testcpp.h
#ifndef TESTCPP_H_ #define TESTCPP_H_ int m_ParamCpp; int AddCpp(int a, int b); #endif /* TESTCPP_H_ */
testcpp.cpp
#include "testcpp.h" int AddCpp(int a, int b) { m_ParamCpp++; return a + b; }
eclipse cdt + Mingw gcc编译的,报错“Main.cpp: multiple definition of `m_ParamCpp'”和“testcpp.cpp:5: first defined here”,我在testcpp.h中已经加了宏定义避免头文件重复包含,怎么会这样?谁能跟我解释一下?