I am using Visual Studio Professional 2015, with Intel Parallel Studio (to provide intel fortran compiler) on Windows machine, and I am testing FFTW routines with a Fortran program that works perfectly fine on a Linux machine. I downloaded and installed FFTW on the Windows machine (converted .def to .lib files), and tested a simple C++ code that calls FFTW functions. This test runs fine.
When doing the same with a test-fortran program, I get the following error message:
1>------ Build started: Project: fftw_fortran_test, Configuration: Debug x64 ------
1>Linking...
1>Searching libraries
1> Searching libfftw3-3.lib:
1> Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\Intel64_win\ifmodintr.lib:
1> Searching C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\compiler\lib\Intel64_win\ifconsol.lib:
.....................................
1> Searching C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64\uuid.lib:
1>Finished searching libraries
1>fftw_fortran_test.obj : error LNK2019: unresolved external symbol DFFTW_PLAN_DFT_1D referenced in function MAIN__
1>fftw_fortran_test.obj : error LNK2019: unresolved external symbol DFFTW_EXECUTE referenced in function MAIN__
1>fftw_fortran_test.obj : error LNK2019: unresolved external symbol DFFTW_DESTROY_PLAN referenced in function MAIN__
1>x64\Debug\fftw_fortran_test.exe : fatal error LNK1120: 3 unresolved externals
1>
1>fftw_fortran_test - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
It appears that the FFTW library is being searched. I also use the following command to look for symbols inside the library and it appears that the functions are in the library
C:>dumpbin /exports libfftw3-3.lib | more
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file libfftw3-3.lib
File Type: LIBRARY
Exports
ordinal name
dfftw_cleanup_
dfftw_cleanup__
dfftw_cleanup_threads_
dfftw_cleanup_threads__
dfftw_cost_
dfftw_cost__
dfftw_destroy_plan_
dfftw_destroy_plan__
dfftw_estimate_cost_
dfftw_estimate_cost__
dfftw_execute_
dfftw_execute__
dfftw_execute_dft_
dfftw_execute_dft__
dfftw_execute_dft_c2r_
dfftw_execute_dft_c2r__
dfftw_execute_dft_r2c_
dfftw_execute_dft_r2c__
dfftw_execute_r2r_
dfftw_execute_r2r__
dfftw_execute_split_dft_
dfftw_execute_split_dft__
dfftw_execute_split_dft_c2r_
dfftw_execute_split_dft_c2r__
dfftw_execute_split_dft_r2c_
dfftw_execute_split_dft_r2c__
dfftw_export_wisdom_
dfftw_export_wisdom__
dfftw_flops_
dfftw_flops__
dfftw_forget_wisdom_
dfftw_forget_wisdom__
dfftw_import_system_wisdom_
dfftw_import_system_wisdom__
dfftw_import_wisdom_
dfftw_import_wisdom__
dfftw_init_threads_
dfftw_init_threads__
dfftw_plan_dft_
dfftw_plan_dft_1d_
dfftw_plan_dft_1d__
dfftw_plan_dft_2d_
dfftw_plan_dft_2d__
dfftw_plan_dft_3d_
dfftw_plan_dft_3d__
I am unable to figure out why the code would not compile and link to the FFTW library. Any help is deeply appreciated. Thanks!
Since FFTW is written in C, I tried adding underscore at the end of the function name but that did not help.
Related
I have a visual studio solution with 3 projects. 2 are DLL. The DLL library from one project is linked to the other via linker. The program runs in Debug mode. But in release mode, it shows LNK2019: unresolved external symbol error. This means the linking is not functioning properly. I rechecked the linker input files and the project dependencies if done properly.
I have a project containing both native and managed C++ code.
Its runtime support is set to /clr.
Its configuration type used to be set to Application, such that it compiled to an .exe. This worked all fine.
But now I want to use this project as a library (.dll) for another project.
So I change the configuration type to dynamic library and rename the main() function to something else.
Then rebuilding the project gives the following two errors.
Error 2 error LNK1120: 1 unresolved externals C:\Projects\MyProject\Source\Debug\MyProject.dll MyProject
Error 1 error LNK2001: unresolved external symbol _main C:\Projects\MyProject\Source\CppSource\LINK MyProject
The corresponding output is as follows.
1>------ Build started: Project: MyProject, Configuration: Debug Win32 ------
1> Main.cpp
1>LINK : error LNK2001: unresolved external symbol _main
1>C:\Projects\MyProject\Source\Debug\MyProject.dll : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Am I forgetting something here?
As Hans Passant suggested, the entry point setting must be blank.
This answer mainly exists to be able to mark this post as solved.
I have been trying to figure this out for a few days and can't seem to find a solution. I am creating a Windows Forms application inside of MSVS 2012 (but the application itself is using MSVS 2010 binaries and .NET 4.0). The application requires the use of CLI/CLR managed code.
I have followed the Getting Started guide and built the libraries using:
bootstrap.bat
.\b2.exe --toolset=msvc-10.0 --build-type=complete
I setup/linked the directories to my project inside of Visual Studio:
C/C++ > General > Additional Include Directories > "C:\Program Files %28x86%29\Microsoft Visual Studio 11.0\Boost"
Linker > General > Additional Library Directories > "C:\Program Files %28x86%29\Microsoft Visual Studio 11.0\Boost\stage\lib"
Here is all that I added to my previously compiling and executing code:
#define BOOST_LIB_DIAGNOSTIC //show diagnostics
#define BOOST_USE_WINDOWS_H
#define BOOST_FILESYSTEM_NO_DEPRECATED //don't use deprecated code
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
Here is the output of the build (Release/Win32):
1>------ Build started: Project: PROJECT_NAME (Visual Studio 2010), Configuration: Release Win32 ------
1> PROJECT_NAME.cpp
1> Linking to lib file: libboost_filesystem-vc100-mt-1_53.lib
1> Linking to lib file: libboost_system-vc100-mt-1_53.lib
1>PROEJCT_NAME.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __clrcall boost::system::system_category(void)" (?system_category#system#boost##$$FYMABVerror_category#12#XZ)
1>PROJECT_NAME.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __clrcall boost::system::generic_category(void)" (?generic_category#system#boost##$$FYMABVerror_category#12#XZ)
1>PROJECT_NAME.obj : error LNK2001: unresolved external symbol "void __clrcall boost::filesystem::path_traits::convert(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::codecvt<wchar_t,char,int> const &)" (?convert#path_traits#filesystem#boost##$$FYMXPB_W0AAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##ABV?$codecvt#_WDH#5##Z)
1>PROJECT_NAME.obj : error LNK2001: unresolved external symbol "public: static class std::codecvt<wchar_t,char,int> const & __clrcall boost::filesystem::path::codecvt(void)" (?codecvt#path#filesystem#boost##$$FSMABV?$codecvt#_WDH#std##XZ)
1>PROJECT_NAME.obj : error LNK2001: unresolved external symbol "class boost::system::error_code __clrcall boost::filesystem::detail::dir_itr_close(void * &)" (?dir_itr_close#detail#filesystem#boost##$$FYM?AVerror_code#system#3#AAPAX#Z)
1>C:\Users\USERNAME\Documents\Visual Studio 2012\Projects\PROJECT_NAME\Release\PROJECT_NAME.exe : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Do I still not have something built/linked correctly? Let me know if there's more information needed and I will supply what I can.
Reviving an old post, I know, but I spent a long time trying to figure out a similar issue, so I'm posting for the next person who comes across similar issues.
For this to work, you'll need to build Boost with VS2012 or download it from Teeks99 or Sourceforge. I was unable to make it work with VS2010.
Change the Platform Toolset to Visual Studio 2012 (v110) in the Project configuration properties. That worked for me when I was trying to figure out a similar problem (#include <boost/filesystem.hpp> in a VS2010 minimal example code). Make sure that the Common Language Runtime Support is set to /clr (NOT /clr:pure).
I'm trying to learn OpenGL and using openglbook.com as my reference. I'm trying to get GLEW and freeglut to work on my computer, and so I'm starting out by going through the steps he lays out for getting them working with Visual Studio here: http://openglbook.com/setting-up-opengl-glew-and-freeglut-in-visual-c. I'm following it to the letter and the only difference is that I'm using Visual Studio 2010 Ultimate.
The issue appears when I try to use GLEW; when this happens I get a linker error. Here's the full text of the error message:
1>------ Build started: Project: gl1, Configuration: Debug Win32 ------
1>Build started 2012/07/28 20:12:19.
1>InitializeBuildStatus:
1> Touching "Debug\gl1.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>main.obj : error LNK2019: unresolved external symbol __imp__glewGetErrorString#4 referenced in function _Initialize
1>main.obj : error LNK2019: unresolved external symbol __imp__glewInit#0 referenced in function _Initialize
1>c:\users\magpie\documents\visual studio 2010\Projects\gl1\Debug\gl1.exe : fatal error LNK1120: 2 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.84
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any help? When I first encountered this error, I tried compiling GLEW from source, but that didn't fix it either (assuming I did that correctly).
This error means that the compiler cannot find the implementation of the methods described in the header file. To statically compile GLEW with your application, add the glew32.lib file to the library search directories (project properties -> VC search directories).
I've been attempting to install glew and freeglut to use with Visual Studio 2010. I followed this guide and have backtracked a few times to make sure I followed it correctly but I still get the following errors when I try and compile the example code at the end:
Error 1 error LNK2019: unresolved external symbol _imp_glutMainLoop#0 referenced in function _main c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
Error 2 error LNK2019: unresolved external symbol _imp_glutDisplayFunc#4 referenced in function _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
Error 3 error LNK2019: unresolved external symbol _imp_glutReshapeFunc#4 referenced in function _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
Error 4 error LNK2019: unresolved external symbol _imp_glutInitDisplayMode#4 referenced in function _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\main.obj Chapter 1 Project
and more just like those. I don't know if its a problem but originally I accidentally grabbed the 64bit version. I realized my mistake and overwrote the files with the 32bit versions, then cleaned and attempted the build again with the same result.
Are you sure that you have done "Step 6: Project Settings (Linker)" in linked guide correctly? It seems that the linker is unable to find symbols that are defined in those libraries (glew and glut32.lib). Also make sure that the Visual Studio knows where to find those libraries (Project->Properties->Configuration properties->VC++ Directories->Library Directories).
All the unresolved external symbols should be found in freeglut.lib. Are you sure that you are properly linking to this library?
Instead of trying to accomplish this in the you could just insert the following line of code in one of your header files:
#pragma comment(lib, "freeglut.lib")
I had this problem too. It turns out I was using the express version of visual studios, so I had to download microsoft sdk to get 64bit openGL libraries. Basically, I found this guide more helpful: http://www.cs.uregina.ca/Links/class-info/315/WWW/Lab1/GLUT/windows.html