D
D
Dima Sokolov2017-09-12 17:47:04
infographics
Dima Sokolov, 2017-09-12 17:47:04

Header file is not connected to the project?

#include "Header.h"
int main()
{
  Second();
}

#pragma once
int Second()
{
  return 0;
}

Error when compiling:
Severity Code Description Project File Line Suppression State
Error LNK2005 "int __cdecl Second(void)" ([email protected]@YAHXZ) already defined in Source.obj Project1 C:\Users\Dima\Documents\Visual Studio 2017\Projects \Project1\Project1\Source1.obj 1
Error LNK1169 one or more multiply defined symbols found Project1 C:\Users\Dima\Documents\Visual Studio 2017\Projects\Project1\Debug\Project1.exe 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Titov, 2017-09-12
@dimka11

In "Header.h" or just
int Second();
and the body is in a separate cpp, or, for short functions,
inline int Second()
{
return 0;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question