Hello everyone. Its been a while since I posted. I've gone through many threads regarding Linking issues that beginning programmers come across. Its the linking error - "error LNK2001 : unresolved external symbol." I admit I am a beginner and I also encounter the same problem. Going through all of the threads I became even more confused. I found no explicit details and the textbooks doesn't cover much of it either. Point is, I came up with a check list, my memory isn't as spiffy as it used to be so I hope that someone can confirm if I have it all correctly stated.
I use a Software Development Kit VC++6 Enterprise version ice-age.
1. I created a blank workspace and added an empty WIN32 windows application project.
2. I immediately go to Menu-Tool-Option and add all the includes, libs, and resources under the directories tab.
3. I then proceed to the coding and organized it as follows:
- Placed the Class definitions in their respective source files
- Placed the Class constructs in their respective header files
- Created a header containment Header file that lists all include directives and any other pre-process directives
- Create a source file that contains the WinMain and WindowProcedure functions
In the example below it demonstrate what I do in my projects-
I created a total of five files. 3 headers and 2 sources.
Headers:
- Engine.h
- HeaderIncludes.h
- Main.h
Sources:
- Engine.cpp
- Main.cpp
In Engine.h-
#include "HeaderIncludes.h"
In Main.h-
#pragma once // Just in case it gets called twice somehow
#include "HeaderIncludes.h"
#include "Engine.h"
In HeaderInclude.h-
#include <windows.h>
#include <windowsx.h>
In Main.cpp-
#include "Main.h"
#include "Engine.h'
In Engine.cpp-
#include "Engine.h"
Sorry, if it gets really long. HMMM, what do you guys think? Is it correct or am I forgetting some steps? Because I wanted to make sure that I'm doing it correctly so I don't get those linking errors ever again and as to boost my morale as a new programmer. Thank you all so very much in advance.