1 Feb,2013

Today i am trying to make a library.


//using namespace std;
class library                         //linecircle library // name of the class
    float point1,point2,point3,point4,radius;     // variables for line and circle
    int style,color,choose;
    char line,line1,line2;
        void user();


#include “liblc.h”

using namespace std;

void newline()   // This function create and writes a line.txt file that draws line.
    ofstream li(“line.txt”);
        li<<“LINE\n 5\n43\n100\nAcDbEntity\n100\nAcDbLine\n 8\n”<<style<<“\n 62\n”<<color<<“\n256\n370\n-1\n  6\nByLayer\n 10\n”<<point1<<“\n20\n”<<point2<<“\n30\n0.0\n11\n”<<point3<<“\n21\n”<<point4<<“\n31\n0.0\n0”;
}     // newline() closed

void newcircle()         //This function create and writes a cir.txt file that draws circle.
    ofstream cir(“cir.txt”);
        cir<<“CIRCLE\n 5\n43\n100\nAcDbEntity\n100\nAcDbCircle\n 8\n0\n 62\n256\n370\n-1\n  6\nByLayer\n 10\n”<<point1<<“\n 20\n”<<point2<<“\n 30\n0.0\n 40\n”<<radius<<“\n  0”;
}          //

void user()
    cout<<“\n\t\t\t****    Draw    ****\n\tPress 1 for Line\n\tPress 2 for circle\n\tEnter your choice: “; //Menu to draw line or circle
    if(choose==1) //getting input for line
        cout<<“\nEnter one point(x,y): “;
        cout<<“\nEnter second point: “;
        cout<<“\nChoose style\nPress 0 for dot\nPress 5 for dashed “;
        cout<<“\nChoose color of a line\nPress 1 for red\nPress 2 for yellow\n Press 3 for green “;
    else if(choose==2) // getting input for circle
        cout<<“\nEnter the radius of circle: “;
        cout<<“Enter the centre coordinates: “;
    else  // if user enters other than 1 and 2, then it displays the following message.
        cout<<“\n You entered wrong choice”;
    if(choose==1||choose==2) //if user enters 1 or 2 then only it will read header.txt,footer.txt,line.txt/cir.txt and write to  .
    {                                    // linecircle.dxf file otherwise jump to else part
        ifstream head(“header.txt”);
        ifstream foot(“footer.txt”);
        ifstream lin(“line.txt”);
        ifstream circ(“cir.txt”);
        ofstream myfile(“linecircle.dxf”);
            myfile<<line<<endl;  // write header.txt to linecircle.dxf
        if(choose==1)                               //if user enters 1 then line.txt will write to linecircle.dxf
        else                                   //if user enters 2 then cir.txt will write to linecircle.dxf
        while(getline(foot,line2,’\n’))       //write footer.txt to linecircle.dxf
        head.close();         // files are closed after reading and writing
    else                          //if user enter other than 1 and 2 then this else part will run
        cout<<“\nNothing draw\n”;
}   //finish


#include “liblc.h”
using namespace std;
int main()  // main() function
    library l;
return 0;


lcmain: liblc.so lcmain.o
    g++  -o main  lcmain.o -L -lliblc

liblc.so: lc.cpp
    g++ -fPIC -c lc.cpp -o lc.o
    g++ -shared -Wl,-soname,liblc.so -o liblc.so lc.o
clean: rm *.o *.so

But when i execute make,

error: variable is not declared in this scope


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s