Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/156.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 编译多个c+时架构x86_64的未定义符号+;文件夹_C++ - Fatal编程技术网

C++ 编译多个c+时架构x86_64的未定义符号+;文件夹

C++ 编译多个c+时架构x86_64的未定义符号+;文件夹,c++,C++,lineTypeUse.cpp #include <iostream> #include "lineType.h" using namespace std; int main() { Line L1(3, 3, 5); cout << "Line 1:"<<endl; L1.NonVertical(); cout << "Line 2:"<<endl; Line L2(2, 1, 5);

lineTypeUse.cpp

#include <iostream>
#include "lineType.h"

using namespace std;


int main()
{
    Line L1(3, 3, 5);
    cout << "Line 1:"<<endl;
    L1.NonVertical();


    cout << "Line 2:"<<endl;
    Line L2(2, 1, 5);
    L2.NonVertical();

    if (L1.isParallel (L2, L1.slope()))
        cout<< "Two lines are parallel"<< endl;
    else 
        cout<<"Not parallel"<<endl;

    L1.isPerpendicular(L2, L1.slope());

    if (!L1.isParallel(L2, L1.slope()))
        L1.doubleersection(L2);

        system("pause");
}
lineTypeImp.cpp

#include <iostream>
#include "lineType.h"
using namespace std;

Line::Line(double x, double y, double z)
{
        a=x;
        b=y;
        c=z;    
}

double Line::getA()
{
    return a;
}

double Line::getB()
{
    return b;
}

double Line::getC()
{
    return c;
}

double Line::slope()
{
    return -a/b;
}


void Line::NonVertical()
{
    if (b!=0)
        cout<<"Slope is:"<< slope()<<endl;
    else
        cout<<"Vertical"<<endl;
}


bool Line::isEqual(Line L2)
{
    if ( (a==L2.getA()&& b==L2.getB() && 
            c==L2.getC()) 
        || (a/L2.getA()==b/L2.getB()==c/L2.getC()))
        return true;
    else
        return false;
}

bool Line::isParallel(Line& L2, double s1) const
{
    if ((s1==L2.slope())
        || (b==0 && L2.getA()==0))
        return true;
    else
        return false;
}

void Line::isPerpendicular(Line& L2, double s1) const
{
    if (((a==0 && L2.getB()==0)
            || (L2.getA()==0 && b==0))
            || (L2.slope()* s1==-1))
        cout<<"Two lines are Perpendicular"<<endl;      
}

void Line::doubleersection(Line& L2) const 
{
    double x,y;
    x=((b*L2.getC()) - (L2.getB()*c)) /
                        ((a*L2.getB()) - (L2.getA()*b));
    y=((L2.getA()*c)-(a*L2.getC())) /
                        ((a*L2.getB())-(L2.getA()*b));
    cout<<"doubleersection podouble:  ("<<x<<",  "<<y<<")"<<endl;
}
下面是我使用的cmpilling命令

g++-o lineTypeImp.cpp lineTypeUse.cpp


如果有人能帮助

-o
之后插入输出文件名或将其完全删除,我将不胜感激。并最终检查
lineTypeImp.cpp
的内容:它可能已被覆盖。谢谢你g++lineTypeImp.cpp lineTypeUse.cpp-o lineType解决了它:)
#include <iostream>
#include "lineType.h"
using namespace std;

Line::Line(double x, double y, double z)
{
        a=x;
        b=y;
        c=z;    
}

double Line::getA()
{
    return a;
}

double Line::getB()
{
    return b;
}

double Line::getC()
{
    return c;
}

double Line::slope()
{
    return -a/b;
}


void Line::NonVertical()
{
    if (b!=0)
        cout<<"Slope is:"<< slope()<<endl;
    else
        cout<<"Vertical"<<endl;
}


bool Line::isEqual(Line L2)
{
    if ( (a==L2.getA()&& b==L2.getB() && 
            c==L2.getC()) 
        || (a/L2.getA()==b/L2.getB()==c/L2.getC()))
        return true;
    else
        return false;
}

bool Line::isParallel(Line& L2, double s1) const
{
    if ((s1==L2.slope())
        || (b==0 && L2.getA()==0))
        return true;
    else
        return false;
}

void Line::isPerpendicular(Line& L2, double s1) const
{
    if (((a==0 && L2.getB()==0)
            || (L2.getA()==0 && b==0))
            || (L2.slope()* s1==-1))
        cout<<"Two lines are Perpendicular"<<endl;      
}

void Line::doubleersection(Line& L2) const 
{
    double x,y;
    x=((b*L2.getC()) - (L2.getB()*c)) /
                        ((a*L2.getB()) - (L2.getA()*b));
    y=((L2.getA()*c)-(a*L2.getC())) /
                        ((a*L2.getB())-(L2.getA()*b));
    cout<<"doubleersection podouble:  ("<<x<<",  "<<y<<")"<<endl;
}
Undefined symbols for architecture x86_64:
  "Line::NonVertical()", referenced from:
      _main in lineTypeUse-c3101c.o
  "Line::slope()", referenced from:
      _main in lineTypeUse-c3101c.o
  "Line::Line(double, double, double)", referenced from:
      _main in lineTypeUse-c3101c.o
  "Line::isParallel(Line&, double) const", referenced from:
      _main in lineTypeUse-c3101c.o
  "Line::doubleersection(Line&) const", referenced from:
      _main in lineTypeUse-c3101c.o
  "Line::isPerpendicular(Line&, double) const", referenced from:
      _main in lineTypeUse-c3101c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)