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.
Related
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.
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