Question

I am confused regarding build failed and compilation failed. If I write some code in Visual Studio then if it reports Build Failed does that also mean that compiler has caught some errors in the program?

Actually after initialzing static variable multiple times, I am getting the build error.

<code>
int Child::count = 1;
int Child::count = 2;
</code>

<code>
1>c:\users\muzammil\desktop\testproject\testproject.cpp(93): error C2374: 'count' : redefinition; multiple initialization
1>          c:\users\muzammil\desktop\testproject\testproject.cpp(83) : see declaration of 'count'
1>
1>Build FAILED.
</code>
Was it helpful?

Solution

A "build" generally refers to the complete process of turning your code and other associated resources into a distributable package whereas "compiling" is just converting the source code to an executable format. In this case, your compilation failed. Since that is one step of the build process, then you can also say the build failed.

Are you also asking how to fix that error? The answer is simply don't declare the same variable multiple times in the same context.

OTHER TIPS

Compiling merely translates between two programming languages. In the case of C++, it means generating machine code out of source code.

Building generally refers to the process of going from your source code to a software product you can ship. It involves several steps:

  • pre-processing
  • compiling
  • linking
  • running tests
  • packaging
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top