If I understand linking correctly, if you include a header file (test.h) in a standalone .cpp file (alone.cpp), and the same header file (test.h) is included in your main cpp file (main.cpp), the files should now be linked together.
Here is what i have:
//FILE: main.cpp
#include <iostream>
#include <string>
#include "FunctionPrototypes.h"
#include "SwitchEnumerations.h"
#include "MenuInformation.h"
using namespace std;
int main() {
MenuInformation MainMenu;
MainMenu.DisplayProgramHeadline();
MainMenu.DisplayProgramInfo();
MainMenu.DisplayMainMenuOptions();
MainMenu.RetriveUserMenuInput();
MainMenuSwitchTree(MainMenu.getUserMenuInput());
return 0;
}
//FILE: MenuSwitchTrees.cpp
#include "FunctionPrototypes.h"
#include "SwitchEnumerations.h"
void MainMenuSwitchTree(const int &_MainMenuChoice) {
//Switch tree
switch (_MainMenuChoice) {
case OpenImageFile: {
//Opens a user-defined image file
void MainMenuOpenImageFile();
}break;
case DisplayOriginalImage: {
//Displays a user-defined image file
void MainMenuDisplayOriginalImage();
}break;
case ExitProgram: {
//Exits the program without saving first
void MainMenuExitProgram();
}break;
default: {
//Displays an error message
void MainMenuErrorMsg();
}break;
}
}
Minor Update:
It seems that the switch statement is executed when an integer value is passed to the function, but however none of the functions under each case label is run. If I for example add the message "cout << " TEST SWITCH TREE FUNCTION #1" << endl;" under the case label "OpenImageFile", i can see the message on screen but the function "void MainMenuOpenImageFile();" is not run. The function "void MainMenuOpenImageFile();" is declared in the "FunctionPrototypes.h" header and the declaration is in the "MainMenuFunctions.cpp" file wich also has the "FunctionPrototypes.h" header defined...
Any help would be highly appreciated!
This post has been edited by hk416: 25 April 2009 - 03:35 PM

New Topic/Question
Reply




MultiQuote





|