Menu

Another problem with using IT++ in Visual Studio 2012 project

Help
2015-09-25
2015-09-27
  • Jerry Derik

    Jerry Derik - 2015-09-25

    Good day. I tried to compile your code here - https://sites.google.com/site/cristeab/home/nist-2.
    I compile GSL libraries and ITPP libraries. Put all headers to %\VisualStudio\VC\include.
    All lib's to %\VC\libs. Dll's to \Windows\System32. When i try to compile the project i get:

    1>------ Build started: Project: Project1, Configuration: Debug Win32 ------
    1>c_statisticaltests.obj : error LNK2019: unresolved external symbol _mxGetNumberOfElements referenced in function "void cdecl itpp::Cvec2mxArray(double ,struct mxArray_tag )" (?Cvec2mxArray@itpp@@YAXPANPAUmxArray_tag@@@Z)
    1>c_statisticaltests.obj : error LNK2019: unresolved external symbol _mxGetPr referenced in function "void
    cdecl itpp::Cvec2mxArray(double ,struct mxArray_tag )" (?Cvec2mxArray@itpp@@YAXPANPAUmxArray_tag@@@Z)
    1>c_statisticaltests.obj : error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_730 referenced in function _mexFunction
    1>c_statisticaltests.obj : error LNK2019: unresolved external symbol _mxArrayToString referenced in function "class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > cdecl itpp::mxArray2string(struct mxArray_tag const *)" (?mxArray2string@itpp@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBUmxArray_tag@@@Z)
    1>c_statisticaltests.obj : error LNK2019: unresolved external symbol _mexErrMsgTxt referenced in function "void
    cdecl itpp::Cvec2mxArray(double ,struct mxArray_tag )" (?Cvec2mxArray@itpp@@YAXPANPAUmxArray_tag@@@Z)
    1>c_statisticaltests.obj : error LNK2019: unresolved external symbol _mexPrintf referenced in function _mexFunction
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_sf_erfc referenced in function "public: double * thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_sf_lngamma referenced in function "private: double
    thiscall StatisticalTests::Pr(int,double)" (?Pr@StatisticalTests@@AAENHN@Z)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_sf_gamma_inc_Q referenced in function "public: double * thiscall StatisticalTests::approximateEntropy(int)" (?approximateEntropy@StatisticalTests@@QAEPANH@Z)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_cdf_ugaussian_P referenced in function "public: double *
    thiscall StatisticalTests::cumulativeSums(void)" (?cumulativeSums@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_wavetable_alloc referenced in function "public: double * thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_wavetable_free referenced in function "public: double *
    thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_workspace_alloc referenced in function "public: double * thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_workspace_free referenced in function "public: double *
    thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_transform referenced in function "public: double * __thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>C:\Users\Jerry\documents\visual studio 2012\Projects\Project1\Debug\Project1.exe : fatal error LNK1120: 15 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    I read your answer to this question ( https://sourceforge.net/p/itpp/discussion/115656/thread/2270e23c/ ), but did not understand how to link DLLs with the project.

    Really looking forward to your reply. And I am sorry for my bad english.

    Sincerely, Jerry.

     
  • Bogdan Cristea

    Bogdan Cristea - 2015-09-27

    Hi Jerry

    NIST Statistical Tests Suite project you found does not need IT++ to be compiled. Some IT++ functions were copied in this project in order to ensure the interface beween MATLAB and C++, but you don't need to compile this interface.

    For compilation you need GSL library, then use cmake in order to generate the compilation system (based on VS projects or something else).

    Please check the project's home page on github for further information:

    https://github.com/cristeab/nist

    regards
    Bogdan

     
  • Jerry Derik

    Jerry Derik - 2015-09-27

    Once again, good afternoon.
    I compiled the project using CMAKE. As result i have:

    c:\Users\Jerry\Desktop\nist\NIST6\build>cmake ..
    -- Building for: Visual Studio 11 2012
    -- The C compiler identification is MSVC 17.0.50727.1
    -- The CXX compiler identification is MSVC 17.0.50727.1
    -- Check for working C compiler using: Visual Studio 11 2012
    -- Check for working C compiler using: Visual Studio 11 2012 -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler using: Visual Studio 11 2012
    -- Check for working CXX compiler using: Visual Studio 11 2012 -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- FindGSL: Found both GSL headers and library
    -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/Jerry/Desktop/nist/NIST6/build

    So I got the project.

    After i try to buil it in visual studio I received:

    C:\Users\Jerry\Desktop\nist\NIST6\src\StatisticalTests.cpp(1036): error C2668: 'fabs' : ambiguous call to overloaded function
    2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\math.h(564): could be 'long double fabs(long double)'
    2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\math.h(516): or 'float fabs(float)'
    2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\math.h(118): or 'double fabs(double)'

    I fix the error.
    (sum += pow(nu[k][i] - double(J)pi[(int)fabs((double)x)][k], 2.0)/double(Jpi[(int)fabs((double)x)][k]);)
    instead ( sum += pow(nu[k][i] - double(J)pi[(int)fabs((x)][k], 2.0)/double(Jpi[(int)fabs(x)][k]);)

    But after i try to build it again i received:

    1> StatisticalTests.cpp
    1>C:\Users\Jerry\Desktop\nist\NIST6\src\StatisticalTests.cpp(619): warning C4244: 'initializing' : conversion from 'int64' to 'unsigned int', possible loss of data
    1>C:\Users\Jerry\Desktop\nist\NIST6\src\StatisticalTests.cpp(626): warning C4244: 'argument' : conversion from '
    int64' to 'int', possible loss of data
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_sf_erfc referenced in function "public: double * thiscall StatisticalTests::frequency(void)" (?frequency@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_sf_lngamma referenced in function "private: double
    thiscall StatisticalTests::Pr(int,double)" (?Pr@StatisticalTests@@AAENHN@Z)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_sf_gamma_inc_Q referenced in function "public: double * thiscall StatisticalTests::blockFrequency(int)" (?blockFrequency@StatisticalTests@@QAEPANH@Z)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_cdf_ugaussian_P referenced in function "public: double *
    thiscall StatisticalTests::cumulativeSums(void)" (?cumulativeSums@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_wavetable_alloc referenced in function "public: double * thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_wavetable_free referenced in function "public: double *
    thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_workspace_alloc referenced in function "public: double * thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_workspace_free referenced in function "public: double *
    thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>StatisticalTests.obj : error LNK2019: unresolved external symbol _gsl_fft_real_transform referenced in function "public: double * __thiscall StatisticalTests::discreteFourierTransform(void)" (?discreteFourierTransform@StatisticalTests@@QAEPANXZ)
    1>C:\Users\Jerry\Desktop\nist\NIST6\build\Debug\statisticaltests.exe : fatal error LNK1120: 9 unresolved externals
    2>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
    2>Project not selected to build for this solution configuration
    ========== Build: 0 succeeded, 1 failed, 2 up-to-date, 1 skipped ==========

    I understand my problem is that there is a file staticaltests.lib which is linked to the project and which contains a reference to the function.

    I apologize that bother with silly questions but I'm trying to get the second week of the project work.

    regards
    Jerry.

     
  • Bogdan Cristea

    Bogdan Cristea - 2015-09-27

    you should check in your project how the GSL library is linked. All errors you have are related to symbols defined by GSL library

     
  • Jerry Derik

    Jerry Derik - 2015-09-27

    Thank you very much, the problem is solved. After all attempts to manually add a library's (gls.lib and cblas.lib) to the linker and it worked.

    regards
    Jerry.

     

Log in to post a comment.