so you need 2 files for this to work? and how to you make the .h files? simply rename the .cpp extension? and dev-cp will recognize it? lolz, didnt knew.
0h, and abit of topic, what would be the difference between
void LineDraw()
and
int LineDraw()
?
EDIT: i tried how you said, i created a DrawLine().h file containing int DrawLine();
then i created the DrawLine().cpp file containing:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <cstdlib>
#include <iostream>
using namespace std;
int DrawLine () // this is the line drawing function
{
const int Length = 80; //change accordingly
for (int i = 0; i < Lenght; i++) // loop
cout << "*" << endl;
}
|
and the main file containing :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <cstdlib>
#include <iostream>
#include "DrawLine().h"
using namespace std;
int main(int argc, char *argv[])
{
DrawLine();
system("PAUSE");
return EXIT_SUCCESS;
}
|
so i opened all 3 files in devcpp on one window (different tabs) and all of them are in the same folder, and when compiling this error comes:
[Linker error] undefined regerence to `DrawLine()'
id returned 1 exit status
[Build Error [Project1.exe] Error 1