part 1
Code: Select all
////////////////////////
//file name is : m1.h
////////////////////////
#ifndef __M1_H__
#define __M1_H__
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
extern char* LCase(char *str);
extern char* UCase(char *str);
#endif
Code: Select all
//////////////////////////
//file name is : m1.cpp
//////////////////////////
#include "m1.h"
char* UCase(char *str)
{
int len=strlen(str);
for(int i=0;i<len;i++){
str[i]=toupper(str[i]);
}
return str;
}
char* LCase(char *str)
{
int len=strlen(str);
for(int i=0;i<len;i++){
str[i]=tolower(str[i]);
}
return str;
}
Code: Select all
/////////////////////////
//file name is : main.h
/////////////////////////
#include <stdio.h>
#include "m1.h"
void main()
{
printf("This is a test\n");
printf("%s\n",UCase("This is a test of UCase"));
printf("%s\n",LCase("This is a test of LCase"));
}
Code: Select all
--------------------Configuration: main - Win32 Debug--------------------
Linking...
main.obj : error LNK2001: unresolved external symbol "char * __cdecl LCase(char *)" (?LCase@@YAPADPAD@Z)
main.obj : error LNK2001: unresolved external symbol "char * __cdecl UCase(char *)" (?UCase@@YAPADPAD@Z)
Debug/main.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
main.exe - 3 error(s), 0 warning(s)
bye
rabbi