hey
Im useing Microsoft Visual C++ 6.0 to program a C program (i think this is the problem ) but anyway i dont have a choice. The problem is very simple but I cant figure it out.
I have three files
header
main
and the one that my functions are defined in and when I compile I get a error saying
lab2.obj : error LNK2001: unresolved external symbol "int __cdecl SetSwitchParm(void)" (?SetSwitchParm@@YAHXZ)
Debug/lab2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Code:
This is the .h
#define MAX 32
void SetSwitchParm(void);
struct Switch {
int iProbStateChange[1];
int iProbGlich[1];
int iDebouncer[1];
int iPresSateSwitch[1];
}SwitchData[MAX];
THe .c - file where the functions are defined
#include <stdio.h>
#include <stdlib.h>
#include "Switch.h"
void SetSwitchParm(void)
{
int lol;
lol= 8;
printf("\n\n\n\nit works\n");
return 0;
}
int GetSwitchParm(int iSwitchID, int iParm)
{
return 0;
}
and the main
#include <stdio.h>
#include "Switch.h"
#include <stdlib.h>
int main()
{
int iNumSwitches;
int h;
SetSwitchParm();//this is the part that wont work
{
printf("Please enter the number of switches: ");
scanf("%d", &iNumSwitches);
if(iNumSwitches > 32){
printf("Please try again the program accepts switches from 1 to 32,\n");
printf("you have entered %d. Please try again.\n\n", iNumSwitches);
}
if(iNumSwitches <= 32)
break;
}
printf("\nhi\n");
return 0;
}
Thanks Guys
HOD