Visual Studio Errors - visual-studio

I have a problem with visual studio. I get these two errors every time I try to compile any project.
Any help how I could resolve this or should I just re-install it ?
error LNK2019: unresolved external symbol WinMain#16 referenced in
function__tmainCRTStartup
error LNK1120: 1 unresolved externals

I think you need to do some changed in your setting like this:
Project properties -> C/C++ -> Linker -> System -> SubSystem: Console
(/SUBSYSTEM:CONSOLE)

Related

Visual Studio 2019: LNK2019: unresolved external symbol error in Release mode

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.

Convert a mixed mode application project (.exe) to a mixed mode dynamic library (.dll)

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.

Visual Studio 2013 external symbol errors with SDL 2.0

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.

Using zlib in Visual C++ project

I've been struggling to compile my Visual C++ 2010 project with dependency of Zlib. I've got source code that worked on Linux and Mac OS X. Here's, where I have linker errors:
error LNK2019: unresolved external symbol _inflate#8 referenced in function...
error LNK2019: unresolved external symbol _inflateInit2_#16 referenced in function...
error LNK2019: unresolved external symbol _deflate#8 referenced in function...
error LNK2019: unresolved external symbol _deflateInit2_#32 referenced in function...
I've been finding solution for few days now, trying compiling Zlib different ways, but it is clear that I've missed something. Very similar question has been answered here, but not clearly enough for amateur like me. I would need step-by-step guide how to get it to work.
Thank you in advance.
If you have static libraries after building the Zlib, point them in your project at this location.Project properties -> Linker -> Input -> Additional dependencies. Give the absolute path.

Problems with freeglut glew in Visual Studio 2010

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

Resources