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).
Related
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.
This error is really driving me nuts! How do I fix it?
This is my output:
1>------ Build started: Project: GenericProjectName, Configuration: Debug x64 ------
1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ)
1>C:\generic\path\to\executable.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
And yes, I have Windows selected as the subsystem.
I managed to fix it. I looked at an older project's settings, and it had "" (nothing!) selected as the subsystem.
I then changed the subsystem of this project and changed it to Not Set (and also deleted the text just to be sure).
Guess what? It worked somehow!
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.
So all I'm trying to do is move from a different IDE to Microsoft Visual Studio 2013. I've done a lot of research to try to fix it but I've tried it all. Here's the code that I'm trying to get working so that everything else can work as well:
#include <SDL.h>
int main(int argc, char* args[])
{
SDL_Init(SDL_INIT_VIDEO);
// game code eventually goes here
SDL_Quit();
return 0;
}
Here's the errors that I get when I try to run "Local Windows Debugger"
1>------ Build started: Project: SDLGame, Configuration: Debug Win32 ------
1> Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _SDL_main
1>Source.obj : error LNK2001: unresolved external symbol __RTC_InitBase
1>Source.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:\Users\Austin\Documents\Visual Studio 2013\Projects\SDLGame\Debug\SDLGame.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here are some pictures of what I've changed to try to fix my issues.
If you go here, you can see 4 pictures. I don't have enough reputation to include them into a hyperlink or whatever. imgur.com/f52YKld,f82dIbc,kUIad56,1DqpiJP#0
I even tried using x64 libraries just in case and it still didn't work.
please see the following tutorial regarding how to correctly configure SDL in Visual Studio
http://zamma.co.uk/setup-sdl2-in-visual-studio/
It looks like you are half way there and that you are just missing the linker configuration for the libraries.
Alright so I already followed the tutorial regarding correctly configuring SDL in Visual Studio BEFORE I posted this. However I've fixed my problem by installing VS Express with window desktop instead of the community one. Isn't REALLY an answer but it worked for me.
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).