Daniel Duffy
C++ author, trainer
- Joined
 - 10/4/07
 
- Messages
 - 10,820
 
- Points
 - 648
 
What sort of message?
What sort of message?
Carla (Barrano) brought it to my attention.
What sort of message?
What sort of message?
Error 3 error LNK1120: 1 unresolved externals c:\users\felix\documents\visual studio 2013\Projects\testmc\Debug\testmc.exe testmc
 
Error 2 error LNK2019: unresolved external symbol "public: __thiscall BoostNormal::BoostNormal(void)" (??0BoostNormal@@QAE@XZ) referenced in function _main c:\Users\felix\documents\visual studio 2013\Projects\testmc\testmc\TestMC.obj testmc
 
Warning 1 warning C4244: 'argument' : conversion from 'double' to 'long', possible loss of data c:\program files (x86)\microsoft visual studio 12.0\vc\include\utilitiesdjd\geometry\range.cpp 156 1 testmc
	Maybe this will help
http://www.datasim.nl/Education/Videos/MyFirstProject/
This is the best piece of information, everIt will save you so much time. It did for me
![]()
Sounds great to me. Would probably make sense between levels 3&4 as a supplementMaybe an additional slide show?
Have you added it to the project? Simply having it open will not suffice.I changed void hello_c() to
void main()
is that what you wanted me to do? It still doesnt work.
// TestPI.cpp
//
// Calculation of PI using random numbers; it's analogous
// to throwing darts.
//
// 2014-9-8 Code portd to C++ 11 from Boost.
//
// (C) Datasim Education BV 2010-2014
//
#include <random> // Convenience header file
#include <iostream>
#include <ctime>            // std::time
int main()
{
    std::default_random_engine rng;
    std::random_device rd;
    rng.seed(rd());
    std::uniform_real_distribution<double> uni(0.0,1.0);
    // Choose the desired accuracy
    std::cout << "How many darts to throw? "; long N; std::cin >> N;
    // Thow the dart; does it fall in the circle or outside
    // Start throwing darts and count where they land
    long hits = 0;
    double x, y, distance;
    for (long n = 1; n <= N; ++n)
    {
        x = uni(rng); y = uni(rng);
        distance = sqrt(x*x + y*y);
        if (distance <= 1.0)
        {
            hits++;
        }
    }
    std::cout << "#hits, PI is: " << hits << ", " << 4.0 * double(hits) / double (N);
       
    return 0;
}
	Hi Daniel, @APalleyMaybe this will help
http://www.datasim.nl/Education/Videos/MyFirstProject/
This is the best piece of information, everIt will save you so much time. It did for me
![]()
Does your Shape destructor have a body defined?Hi Daniel, @APalley
I'm still getting link errors after I followed this instruction and add additional include directories. Could you please tell me where went wrong? Thanks!
1>Shape.obj : error LNK2005: "public: class YC::CAD::Shape & __thiscall YC::CAD::Shape::operator=(class YC::CAD::Shape const &)" (??4Shape@CAD@YC@@QAEAAV012@ABV012@@Z) already defined in Point.obj
1>Circle.obj : error LNK2019: unresolved external symbol "public: __thiscall YC::CAD::Shape::~Shape(void)" (??1Shape@CAD@YC@@QAE@XZ) referenced in function __unwindfunclet$??0Circle@CAD@YC@@QAE@XZ$0
1>Line.obj : error LNK2001: unresolved external symbol "public: __thiscall YC::CAD::Shape::~Shape(void)" (??1Shape@CAD@YC@@QAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall YC::CAD::Shape::~Shape(void)" (??1Shape@CAD@YC@@QAE@XZ)
1>Point.obj : error LNK2001: unresolved external symbol "public: __thiscall YC::CAD::Shape::~Shape(void)" (??1Shape@CAD@YC@@QAE@XZ)
1>C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Level 5\3.4-Exercise2\Debug\3.4-Exercise2.exe : fatal error LNK1120: 1 unresolved externals
Thank you APalley @APalley, I made a silly mistake to forget to write destructor lol..Does your Shape destructor have a body defined?
Shape& Shape::operator=(const Shape& source)
{//Assignment operator.
    cout<<"Shape assignment operator is called."<<endl;
    if (this == &source)
        return *this;
    this->m_id = source.m_id;  
    return *this;
}
	Point& Point::operator = (const Point& source)          
{//Print out text in assignment operator.
  
    cout<<"Point assignment operator called."<<endl;
    if (this==&source)  
        return *this;
    Shape::operator=(source);  
    this->m_x = source.m_x;
    this->m_y = source.m_y;
    return *this;
}