Visual Studio error LNK2005 - c++

I'm having problems with Visual Studio. Even though the code worked earlier, I keep getting this error now:
1>------ Build started: Project: Lab3, Configuration: Debug Win32 ------
1>Q3.obj : error LNK2005: _main already defined in Q1.obj
1>C:\Users\Carlos\documents\visual studio 2010\Projects\Lab3\Debug\Lab3.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

You have two files (Q1 and Q3) that both define main. You can only define main once in the entire project.

Related

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

LNK1117: Syntax error in option "VERSION:1.0.0" [duplicate]

This question already has answers here:
DEF file syntax error in visual studio 2012
(2 answers)
Closed 8 years ago.
i have a very curious problem, when i try to build with Visual Studio 2013.
Anyone can help me?
What i'm doing wrong?
Original Message (German)
1>------ Erstellen gestartet: Projekt: npworpg, Konfiguration: Debug Win32 ------
1>LINK : fatal error LNK1117: Syntaxfehler in Option "VERSION:1.0.0".
========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========
Translated
1>------ Creating started: Project: npworpg, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1117: Syntaxerror in Option "VERSION:1.0.0".
========== Created: 0 success, 1 error, 0 current, 0 skipped ==========
I've found the Problem!
On the Settings (Project > Settings > Linker) removing the "Version" entry.

VC 2008 fatal error C1047 cplus fix?

Hello everyone i am using VC 2008 c++ and i got some project that isn't mine.
The project rebuilds successfully, but the problem is the project doesn't create all the .lib files that are needed for another project and so i got:
1>------ Build started: Project: application_manager, Configuration: Release Win32 ------
1>Linking...
1>LINK : warning LNK4224: /OPT:NOWIN98 is no longer supported; ignored
1>fatal error C1047: The object or library file 'C:\Users\modestas\Desktop\代码\server\../contrib/lib/tinyxml/\tinyxml_stl.lib' was created with an older compiler than other objects; rebuild old objects and libraries
1>LINK : fatal error LNK1257: code generation failed
1>Build log was saved at "file://C:\Users\modestas\Desktop\代码\server\temp\application_manager\Release\BuildLog.htm"
1>application_manager - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
this project already has tinyxml_stl.lib, but the tinyxml project doesn't build a new one so i got this error how to fix this error?
The error is caused by tinyxml_stl.lib being compiled using an older version of the compiler than you are using to compile application_manager
Since your tinylib project no longer creates this file as output I assume that this is simply the result of the previous developer leaving you with a mess of files. If you change your application_manager to link to the correct binaries created by tinyxml and remove the link to tinyxml_stl.lib you should be able to compile.

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"