visual studio fatal error LNK1120: - c++

just i wanted to make a program using viual stidio 2010
when i do build i have this excaption
i just wrote empty main c++ program (no syntax errors)
what i got is:
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>c:\users\dell\documents\visual studio 2010\Projects\test\Debug\test.exe :
fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
code is :
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
please help me to fix it asap
thanks ,,

You created a Win32-Project! Make sure that you choose Console Application in the project wizard.

Look at your project property. Just go to project settings, linker settings, then system. Check your subsystem setting.You can change subsystem to "not set".It will link based on which entry point function you have defined.

Related

Unresolved External Symbol __imp__Py_Finalize

I literally just got Python.h to link to my Visual Studio 2017 IDE and then when I ran it, it spat this error out for me.
I use VS2017, and I am learning C++, so I have no idea why this is happening. I linked my Python.h file's directory in the project properties.
Full Build Logs:
1>------ Build started: Project: PyC++, Configuration: Release Win32 ------
1>PyC++.obj : error LNK2001: unresolved external symbol __imp__Py_Finalize
1>PyC++.obj : error LNK2001: unresolved external symbol __imp__Py_SetProgramName
1>PyC++.obj : error LNK2001: unresolved external symbol __imp__Py_InitializeEx
1>C:\Users\maste\source\repos\PyC++\Release\PyC++.exe : fatal error LNK1120: 3 unresolved externals
1>Done building project "PyC++.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Try to include pythonxx.lib(such as python26.lib) in your references.
The answer is simple, like #Xiaoying Sun has stated, put the python38.lib file in your references, however, you're required to put it in your VC++ directories, this way it will work.

Error in Visual studio 2015 after installing SFML

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

gmp.h /mpir.h linker in visual studio 2012 professional

I am trying to use gmp.h for C/C++. I am currently working on visual studio 2012 professional. I followed the instructions from the link. But still I got error messages...
1>------ Build started: Project: final, Configuration: Debug Win32 ------
1> final.cpp
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_init referenced in function _wmain
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_init_set_ui referenced in function _wmain
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_out_str referenced in function _wmain
1>D:\New folder\final\Debug\final.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I tried all possible options but could not got the solution. Please help me out
I had the same problem and it was just that I wasn't linking the library.
You need to include the library in the Visual Studio project.
How to add additional libraries to Visual Studio project?

C++ Errors: LNK2001 and LNK1120

I realize this is kind of an incomplete question, but I'm a student not thoroughly versed in debugging yet. When I try to compile I get the following output:
------ Build started: Project: p05Inheritance, Configuration: Debug Win32 ------
employee.cpp
employee.obj : error LNK2001: unresolved external symbol "private: static class CE::Company CE::Employee::company" (?company#Employee#CE##0VCompany#2#A)
c:\documents and settings\km\my documents\visual studio 2010\Projects\p05Inheritance\Debug\p05Inheritance.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Does anyone know how I can go about resolving this? Thanks in advance, and let me know if you need any more information.
It appears that CE::Employee::company is not defined anywhere for the linker to find. I suggest you give a little more info in your snippet ie the class in question for us to help you more precisely.

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"