Error from compiler on class point slope program

This is a discussion on Error from compiler on class point slope program within the C++ Programming forums, part of the General Programming Boards category; I am getting an unresolved external error for the program below. Any ideas on what is causing this error. I ...

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    25

    Error from compiler on class point slope program

    I am getting an unresolved external error for the program below. Any ideas on what is causing this error. I still have to write the program to test these functions.

    error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
    fatal error LNK1120: 1 unresolved externals




    Code:
    #include<iostream>
    #include<cmath>
    using namespace std;
    
    class CartesianPoint
    {
    	float x,y;
    	public:
    		CartesianPoint(float x1,float y1)
    		{
    			x=x1;y=y1;
    		}
    		void operations()
    		{
    			cout<<"\n Distance from x-axis : "<<y;
    			cout<<"\n Distance from y-axis : "<<x;
    			float d;
    			d=sqrt(x*x+y*y);
    			cout<<"\n Distance from origin : "<<d;
    		}
    };
    class LineSegment
    {
    	float x1,y1,x2,y2;
    	float mx,my;
    	public:
    		LineSegment(float x11,float y11,float x12,float y12)
    		{
    			x1=x11;y1=y11;x2=x12;y2=y12;
    			CartesianPoint c1(x1,y1),c2(x2,y2);
    			c1.operations();
    			c2.operations();
    		}
    		void midpt()
    		{
    			mx=(x1+x2)/2;
    			my=(y1+y2)/2;
    			cout<<"\n Line joining ("<<x1<<","<<y1<<") and ("<<x2<<","<<y2<<") :";
    			cout<<"\n The mid-point is- ("<<mx<<","<<my<<")";
    		}
    		void perpbis()
    		{
    			float m;
    			m=(y2-y1)/(x2-x1);
    			m=(-1)/m;
    			cout<<"\n Equation of perpendicular bisector is: ";
    			cout<<"\n y-"<<my<<"="<<m<<"(x-"<<mx<<")";
    		}
    };
    class Line
    {
    	float m,x,y;
    	public:
    		Line(float m1,float x1,float y1)
    		{
    			m=m1;x=x1;y=y1;
    		}
    		void pseq()
    		{
    			cout<<"\n Point-Slope Equation is :";
    			cout<<"\n y-"<<y<<"="<<m<<"(x-"<<x<<")";
    		}
    		void intercept()
    		{
    			
    			cout<<" \n Intercept on x-axis: "<<x-y/m;
    			cout<<" \n Intercept on y-axis: "<<y-m*x;
    		}
    
    };

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    >> I still have to write the program to test these functions.
    That's it. You have to write a main function before you can link everything into an executable. You can make an empty main to get it to finish linking if you want.

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    or just don't link. you could select compile rather than build (if its visual studio). If its gcc just use the -c flag
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Struct Program to find Point in Rectangle
    By DMJKobam in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2009, 09:56 PM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 02:30 PM
  4. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 07:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21