• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering.
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job.
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models.

Compile Errors != Linker Errors, BTW why do I get Linker errors?

Daniel Duffy

C++ author, trainer
Thank you APalley @APalley, I made a silly mistake to forget to write destructor lol..
After adding destructor, I still got one link error:

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>C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Level 5\3.4-Exercise2\Debug\3.4-Exercise2.exe : fatal error LNK1169: one or more multiply defined symbols found
Below is my code for operator = in shape and point:

C++:
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;
}
C++:
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;
}

Thanks!

one or more multiply defined symbols found
 

Daniel Duffy

C++ author, trainer
C++:
#include <iostream>

// Daniel J. Duffy

struct IntComparator
{
    bool operator()(const double& a, const double& b) const
    {
        return a < b;
    }
};

// C++11 VS2013 Community version free downloadable

int main()
{
    double a = 20.00; double b = 20.0001;

    IntComparator ic;
    std::cout << ic(a, b) << std::endl;

    // Lambda function
    auto Compare = [](const double& a, const double& b) -> bool { return a < b; };
    auto CompareII = [](const double& a, const double& b) -> bool { return a > std::exp(b); };

    std::cout << Compare(a, b) << std::endl;
    std::cout << CompareII(a, b) << std::endl;

    return 0;

}
 

Daniel Duffy

C++ author, trainer
QUIOTE-->

I also had the same problem and then I realised that I should have changed my "ExcelImports.cpp" to adapt it to MS 2013.

I rewrote my ExcelImports.cpp file in the following way:
// Office 2013 (Office v15)
#import "C:\Program Files\Microsoft Office 15\root\vfs\ProgramFilesCommonX86\Microsoft Shared\OFFICE15\MSO.DLL" rename("DocumentProperties", "DocumentPropertiesXL") rename("RGB", "RGBXL")
#import "C:\Program Files\Microsoft Office 15\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE" rename("DialogBox", "DialogBoxXL") rename("RGB", "RGBXL") rename("DocumentProperties", "DocumentPropertiesXL") rename("ReplaceText", "ReplaceTextXL") rename("CopyFile", "CopyFileXL") no_dual_interfaces

I am using Window 7 Ultimate (64 bit operating system).
 

Daniel Duffy

C++ author, trainer
An article on Black Scholes PDE and FDM for non-specialists. It might be useful as preparation for QN C++ course. I wrote it for a mathematical audience outside of computational finance.
 

Attachments

  • From Navier-Stokes to Black-Scholes Numerical Methods in Computational Finance.pdf
    80.2 KB · Views: 120

Daniel Duffy

C++ author, trainer
The 13 Golden Rules of Debugging
1. Understand the requirements
2. Make it fail
3. Simplify the test case
4. Read the right error message
5. Check the plug
6. Separate facts from interpretation
7. Divide and conquer
8. Match the tool to the bug
9. One change at a time
10. Keep an audit trail
11. Get a fresh view
12. If you didn’t fix it, it ain’t fixed
13. Cover your bugfix with a regression test

14.Sometimes a good rule is: remove/comment out stuff until the code starts working; then uncomment slowly, slowly.
 

Daniel Duffy

C++ author, trainer
Directory setting Boost 1.59 for VS2015 Community
 

Attachments

  • add1.jpg
    add1.jpg
    121.3 KB · Views: 144
  • add2.jpg
    add2.jpg
    146.9 KB · Views: 142

ExSan

Well-Known Member
Directory setting Boost 1.59 for VS2015 Community
I can not reproduce image 2/2

LINKER/ADDITIONAL LIBRARY DIRECTORIES

I can only set to this:
C:\BOOST\boost_1_59_0;%AdditionalLibraryDirectories)

but not to lib-32- msvc
should I include this manually ?

.........
I can compile the directive
#include <boost/format.hpp>

when I try this directive
//#include <boost/chrono.hpp>
or
//#include <boost/chrono/chrono.hpp>

I get error compilation... something is not working? what am I missing ?
thanks in advance DD ! ;)
 

Daniel Duffy

C++ author, trainer
See the directory structure

The install has to be done properly

but not to lib-32- msvc should I include this manually ?
You need this directory as part of the automagic install. If not, try again until you get it right.

14.0 !!!!!!!!!!!!!!
 

Attachments

  • add3.jpg
    add3.jpg
    176.7 KB · Views: 126

ExSan

Well-Known Member
See the directory structure

The install has to be done properly

but not to lib-32- msvc should I include this manually ?
You need this directory as part of the automagic install. If not, try again until you get it right.

14.0 !!!!!!!!!!!!!!
it seems to work now. thanks !!!
 

ExSan

Well-Known Member
QUIOTE-->

I also had the same problem and then I realised that I should have changed my "ExcelImports.cpp" to adapt it to MS 2013.

I rewrote my ExcelImports.cpp file in the following way:
// Office 2013 (Office v15)
#import "C:\Program Files\Microsoft Office 15\root\vfs\ProgramFilesCommonX86\Microsoft Shared\OFFICE15\MSO.DLL" rename("DocumentProperties", "DocumentPropertiesXL") rename("RGB", "RGBXL")
#import "C:\Program Files\Microsoft Office 15\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE" rename("DialogBox", "DialogBoxXL") rename("RGB", "RGBXL") rename("DocumentProperties", "DocumentPropertiesXL") rename("ReplaceText", "ReplaceTextXL") rename("CopyFile", "CopyFileXL") no_dual_interfaces

I am using Window 7 Ultimate (64 bit operating system).
Dear DD,
I am having difficulties to compile and execute your program ExcelHelloWorld, could you please update the import directives

This is my environment
Windows10 + MS Visual Studio Community 2015
 
Last edited:

Daniel Duffy

C++ author, trainer
Dear DD,
I am having difficulties to compile and execute your program ExcelHelloWorld, could you please update the import directives

This is my environment
Windows10 + MS Visual Studio Community 2015

Which version of Excel are you using? Where are these files on your system?
 
Last edited:

ExSan

Well-Known Member
C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\MSO.DLL

C:\Program Files (x86)\Common Files\Microsoft\VBE6EXT.OLB Shared\VBA\VBA6\VBE6EXT.OLB

C:\Program Files\Microsoft Office\Office14\EXCEL.exe

Microsoft® Office/Excel 2010 (Version 14 - 64 bits)

THANKS IN ADVANCE ;)
R
 

Daniel Duffy

C++ author, trainer
C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\MSO.DLL

C:\Program Files (x86)\Common Files\Microsoft\VBE6EXT.OLB Shared\VBA\VBA6\VBE6EXT.OLB

C:\Program Files\Microsoft Office\Office14\EXCEL.exe

Microsoft® Office/Excel 2010 (Version 14 - 64 bits)

Are these similar to the issues you are having with VS2015 and Boost ... 32 v 64?

THANKS IN ADVANCE ;)
R

I think you are mixing 32/64! (?)
Programs Files vs Program files (x86)

In the initial stages I advise sticking to 32 bit libs and projects etc. to avoid getting bogged down in OS issues.

@APalley
 
Last edited:
Top