Error in Visual studio 2015 after installing SFML - c++

recently I've installe SFML for Visual studio 2015. I have read the tutorial for this specific task on there web site but after the test (compiling and running debug) this error show up:
https://pastebin.com/mY7r7zy9
1>------ Build started: Project: projet game, Configuration: Debug Win32 ------
1> main.cpp
1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ)
1>C:\Users\Cewein\documents\visual studio 2015\Projects\projet game\Debug\projet game.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
why and what should i do ?
should i rename my main.cpp to winmain.cpp ?
thanks you for the help
P.S: VS2015 is one the main drive where the OS is (C:) but SFML the folder is on another drive (E:)

If your subsystem is set to Windows (/SUBSYSTEM:WINDOWS), you need to link sfml-main, which will define WinMain() and call main().
If your subsystem is set to Console (/SUBSYSTEM:CONSOLE), then you don't need to link sfml-main.
To change the subsystem, go to your project settings, then Properties -> Linker -> System -> SubSystem

Related

How to solve 'error LNK2001: unresolved external symbol' for writing a User-defined Model (FLAC) in Visual Studio 2010 C++?

I am trying to write a User-defined Model in C++ for FLAC in Visual Studio Express 2010 C++. Initially, I am trying to run (debug and build) the built-in Strain-softening Model based on the Mohr-Coulomb criterion (Available in FLAC 8.0) by changing its name only. Once I succeed to do it, I will try to modify it as per my requirement. I am running the code in VS2010. I have already installed SDK7.1, VS2010 SP1, etc. However, I am getting the following error msg:
1>------ Build started: Project: i_ssoft, Configuration: Debug x64 ------
1> modeli_ssoft.cpp
1> Creating library C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\i_ssoft.lib and object C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\i_ssoft.exp
1>modeli_ssoft.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl models::ConstitutiveModel::getPluginName(void)const " (?getPluginName#ConstitutiveModel#models##UEBA?AV?$basic_string#_WU?$char_traits#_W#std##V?$allocator#_W#2##std##XZ)
1>C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\\i_ssoft.dll : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
From the error code, it is clear that I need to add some libraries or I need to place the supporting libraries in the same project directory... which I have tried but still, I am getting the error.

Imports path in visual studio for excel drivers in c++

I want to import excel driver in c++ using ExcelImport.cpp file but the visual studio is unable to open my file. I am giving the directory of my c folder but the visual studio is looking in its directory folder. I already include my path in additional directories but it's not working I want to write results in an excel file. Here are my include paths and the error list.
I want to do the same exactly that is followed by under this link but in my case the imports are not working
interface with excel c++
ExcelImports.cpp
#import "C:\Program Files\Microsoft Office 15\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE15\MSO.DLL"
#import "C:\Program Files\Microsoft Office 15\root\VFS\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\vbe6ext.olb"
#import "C:\Program Files\Microsoft Office 15\root\Office15\excel.exe"
MyfunctionCode.cpp
double GetDoubleFromCell(Excel::_WorksheetPtr sheet, CComBSTR cell)
{
Excel::RangePtr range=sheet->GetRange(CComVariant(cell));
_variant_t value=range->GetValue2();
return value;
}
I am trying to import MSO.dll file but it is importing MSO.tlh
output Window :
Build started...
1>------ Build started: Project: ExcelVisualisation, Configuration: Debug Win32 ------
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ)
1>E:\Hamza ku\Tuition C++\Level9\Level9Code\Level9Code\Projects\ExcelVisualisation\Debug\ExcelVisualisation.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "ExcelVisualisation.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Unresolved external symbol _glfwInit due to 32-bit/64-bit mismatch

How do I link the library in a way that visual studio 2015 can actually see it?
Here's a few screenshot of my folders:
glfw3, glfw3/include/glfw/, glfw3/lib
I've attempted to link these folders into visual studio, under "vc++ directories => include/library directories as such: include, library
also linking the same to my project directly, under linker => input => additional dependencies
to me, that seems like everything is correct (this is how it was in the tutorial i am following, learnopengl.com)
note: I am also doing the same with the GLAD library, which that has a .c file that I put directly into my sources, along with the header files linked the same way as with GLFW.
but despite trying to run this code:
#include <glad/glad.h>
#include <GLFW/glfw3.h>
int main() {
glfwInit();
return 0;
}
it will always return this error, or similar ones:
1>------ Build started: Project: opengl_test, Configuration: Debug Win32 ------
1> main.cpp
1>main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
1>C:\Users\Honza\Desktop\C++ programs\lib\glfw3\lib\glfw3.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
1>c:\users\honza\documents\visual studio 2015\Projects\opengl_test\Debug\opengl_test.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm guessing there is something wrong with how I linked the libraries. I am willing to literally re-install visual studio if I have to, just please give me some possible solutions. I want to start learning opengl but all this jazz with linking libraries is leaving me frustrated and confused.
EDIT: The problem here was that I was using 64-bit GLFW binaries instead of the 32-bit ones, and compiling in 32-bit. I've fixed that, and now I get even more errors:
1>------ Build started: Project: opengl_test, Configuration: Debug Win32 ------
1>libglfw3.a(init.c.obj) : error LNK2019: unresolved external symbol ___chkstk_ms referenced in function __glfwInputError
1>libglfw3.a(init.c.obj) : error LNK2019: unresolved external symbol _vsnprintf referenced in function __glfwInputError
1>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol _vsnprintf
1>libglfw3.a(context.c.obj) : error LNK2019: unresolved external symbol _sscanf referenced in function __glfwRefreshContextAttribs
1>MSVCRTD.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __vsnprintf
1>C:\Users\Honza\Documents\Visual Studio 2015\Projects\opengl_test\Debug\opengl_test.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
You write that you tried to link "these folders", while in fact, you need 2 separate things in order to use a function from a static library.
Use the proper header file so compilation succeeds. From the error you quoted, compilation went well. The program knows there is an external function named _glfwInit.
Link to the specific library (.lib file). Looks like you placed a path of a folder and not the full path of the .lib file.
Under Linker => input => additional dependencies, place the full path of the gfw3.lib file.
I faced the same problem while following learnopengl.com, The issue is that you need to rebuild glfw library with cmake again,
but this time when you choose visual studio 2015 or whatever for your generator for this project, you must also choose: OPTIONAL PLATFORM FOR GENERATOR -> x64
you can make sure that every thing is OK when you build glfw inside Visual Studio and the platform that appears is x64

Visual C++ 2010 error. Can't Find program.exe when running

This is the message I get
Unable to start program C:\Users\Documents\Visual Studio 2010\Projects\EULER'S Fixed\Debug\EULER'S Fixed.exe
The system cannot find the file specified.
Here is the Build Output
1>------ Build started: Project: EULER'S Fixed, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:\Users\adicpluplu\Documents\Visual Studio 2010\Projects\EULER'S Fixed\Debug\Debug\EULER'S Fixed.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
You have missed to define main:
int main()
{
//..
return 0;
}
You get that message when you fail to save all before the first compile.
I consider it to be a defect in 2010. Creating a new project, or adding files to a project or deleting files from a project don't actually save. You have to manually save before they are really there.
Select the properties for the file in which main is defined and make sure "item type" under "General" (under Configuration Properties) is set to "c/c++ compiler"

Build Error "LNK2019: unresolved external symbol _WinMain#16"

So, I am a total noob at C++ and I need serious help. I bet for some average users this is not even a problem, so please help me.
I wrote this in Visual Studio Professional as a Win32 console file.
#include <iostream>
using namespace std;
int main()
{
int i = 100;
return 0;
}
And in the console I get the following:
1>------ Build started: Project: Project1_RenatoAlegre, Configuration: Debug Win32 ------
1>Build started 1/25/2012 3:09:03 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Project1_RenatoAlegre.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
1>c:\users\ren\documents\visual studio 2010\Projects\Project1_RenatoAlegre\Debug\Project1_RenatoAlegre.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.37
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have no way of running the program because of this "1 failed" something. I must run the program in Visual Studio Professional.
Project properties -> C/C++ -> Linker -> System -> SubSystem: Console (/SUBSYSTEM:CONSOLE)
If you want a console project.
Please change the subsystem in your linker settings from Windows to Console.
Right click on the Project name in the Solution Explorer
Select Properties
Open Linker in Configuration Properties
Subsystem will be the first item on the list.
Select Console (/SUBSYSTEM:CONSOLE) on the dropdown