visual c++ - Error: Struct already definded in *.Obj -
Support, I am using VC ++ and I am always getting LNK2005 and LNK1169 when error while running my script You can tell, why can you tell me why it is happening and how to fix it, thank you! Code:
In the main.cpp
#include "stdafx.h #include & lt; Windows.h & gt; # Include & lt; stdio.h & Gt; # Include & lt; stdlib.h & gt; #include "Modifier.h" namespace std; HWND myconsole = GetConsoleWindow (); HDC mydc = GetDC (myconsole); int main () {if (Input.beg ( "Hello")) {cout in "modifier.cpp"
< Code> #include "stdafx.h" # Include & lt; iostream & gt; # Include & lt; string & gt; # Include & lt; sstream & gt; Namespace std; struct {bool beg (string A) {string b; getline (cin, b); if (b == a) {return true;} Else {}}} Input In "modifier.h"
#include "modifier.cpp"
You will need to change your header declaration: You are unknowingly declaring a different, global "input" variable in each CPP "Modifier H".
Suggestion:
// modifier.h #ifndef MODIFER_H #define MODIFIER_H Structure input {bool b like (string A) {string b; Gateline (pin, b); If (B == A) {return true; } other { } } }; #endif Then, in Modifier.cpp:
#include "Modifier.h" Structure input global input; You not one. CPP should be included in one .h. You should include headers in source files, not exactly the opposite. And you should definitely consider using "class" instead of "structure". Because, obviously, what your "input" is is: just one method, no state / no data.
Comments
Post a Comment