Fatal error c1001 внутренняя ошибка компилятора

While compiling on x64 plattform I am getting following error: c:codavs05hpsw-scovpacctoolscodaaccesstestcoda_access.cpp(1572): fatal error C1001: An internal error has occurred in the compi...

While compiling on x64 plattform I am getting following error:

c:codavs05hpsw-scovpacctoolscodaaccesstestcoda_access.cpp(1572): fatal error C1001: An internal error has occurred in the compiler.

(compiler file 'f:ddvctoolscompilerutcsrcp2sizeopt.c', line 55)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

------ Build started: Project: asyncexample, Configuration: Release Win32 ------

If I change settings to preprocessor file (Yes) i am not getting any error.

About my environment: Upgrading Microsoft Visual Studio 2005 to 2010

Please help.

LuFFy's user avatar

LuFFy

8,33110 gold badges38 silver badges59 bronze badges

asked Aug 16, 2011 at 10:01

venkat's user avatar

4

I have had this problem with VS2015 while building locally in Windows.

In order to solve it, I deleted my build folder (Output Directory as seen in Properties/General) and rebuilt the project.

This always seems to help when strange things happen during the build.

answered Aug 2, 2017 at 8:36

Autex's user avatar

AutexAutex

1971 silver badge12 bronze badges

I’ve encountered this error many times in VC++. Do the following steps. They’ve sometimes helped me with this issue:

  1. Take a look at the exact location, pointed out by compiler error.
  2. Find any external types or classes used there at that location.
  3. Change the order of “include path” of those files found in step 2 and rebuild the solution.
  4. I hope that help !!!!

answered Aug 16, 2011 at 10:17

TonySalimi's user avatar

TonySalimiTonySalimi

8,1044 gold badges32 silver badges62 bronze badges

0

I am getting same error with VC2012. Setting up the project properties Optimization to Disabled (/Od) resolved the issue.

answered Feb 3, 2014 at 12:27

anil's user avatar

anilanil

9711 gold badge11 silver badges23 bronze badges

2

In my solution, i’ve removed output dll file of the project, and I’ve made project rebuild.

answered Apr 27, 2017 at 16:52

Paweł Iwaneczko's user avatar

Paweł IwaneczkoPaweł Iwaneczko

8131 gold badge10 silver badges13 bronze badges

I encountered the same error and spent quite a bit of time hunting for the problem. Finally I discovered that function that the error was pointing to had an infinite while loop. Fixed that and the error went away.

answered Mar 7, 2014 at 1:45

quitePro's user avatar

quiteProquitePro

5465 silver badges3 bronze badges

In my case was the use of a static lambda function with a QStringList argument. If I commented the regions where the QStringList was used the file compiled, otherwise the compiler reported the C1001 error. Changing the lambda function to non-static solved the problem (obviously other options could have been to use a global function within an anonymous namespace or a static private method of the class).

answered Jan 30, 2017 at 10:57

cbuchart's user avatar

cbuchartcbuchart

10.5k7 gold badges53 silver badges87 bronze badges

I got this error using boost library with VS2017. Cleaning the solution and rebuilding it, solved the problem.

answered Feb 27, 2018 at 16:06

Tides's user avatar

TidesTides

11111 bronze badges

I also had this problem while upgrading from VS2008 to VS2010.

To fix, I have to install a VS2008 patch (KB976656).

Maybe there is a similar patch for VS2005 ?

answered Jan 9, 2013 at 16:33

Philippe's user avatar

I got the same error, but with a different file referenced in the error message, on a VS 2015 / x64 / Win7 build. In my case the file was main.cpp. Fixing it for me was as easy as doing a rebuild all (and finding something else to do while the million plus lines of code got processed).

Update: it turns out the root cause is my hard drive is failing. After other symptoms prompted me to run chkdsk, I discovered that most of the bad sectors that were replaced were in .obj, .pdb, and other compiler-generated files.

answered Sep 6, 2016 at 22:54

hlongmore's user avatar

hlongmorehlongmore

1,53525 silver badges27 bronze badges

I got this one with code during refactoring with a lack of care (and with templates, it case that was what made an ICE rather than a normal compile time error)

Simplified code:

void myFunction() {
    using std::is_same_v;
    for (auto i ...) {
       myOtherFunction(..., i);
    }
}

void myOtherFunction(..., size_t idx) {
    // no statement using std::is_same_v;
    if constexpr (is_same_v<T, char>) {
        ...
    }
}

answered Nov 27, 2017 at 5:36

chrisb2244's user avatar

chrisb2244chrisb2244

2,91022 silver badges43 bronze badges

I had this error when I was compiling to a x64 target.
Changing to x86 let me compile the program.

answered Oct 17, 2017 at 14:38

Robert Andrzejuk's user avatar

Robert AndrzejukRobert Andrzejuk

4,9932 gold badges23 silver badges30 bronze badges

Sometimes helps reordering the code. I had once this error in Visual Studio 2013 and this was only solved by reordering the members of the class (I had an enum member, few strings members and some more enum members of the same enum class. It only compiled after I’ve put the enum members first).

answered Jun 12, 2019 at 13:51

Liviu Stancu's user avatar

In my case, this was causing the problem:

std::count_if(data.cbegin(), data.cend(), [](const auto& el) { return el.t == t; });

Changing auto to the explicit type fixed the problem.

answered Nov 13, 2019 at 15:06

The Quantum Physicist's user avatar

Had similar problem with Visual Studio 2017 after switching to C++17:

boost/mpl/aux_/preprocessed/plain/full_lambda.hpp(203): fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'msc1.cpp', line 1518)
1> To work around this problem, try simplifying or changing the program near the locations listed above.

Solved by using Visual Studio 2019.

answered Jan 15, 2020 at 12:04

Dmytro's user avatar

DmytroDmytro

1,25216 silver badges21 bronze badges

I first encountered this problem when i was trying to allocate memory to a char* using new char['size']{'text'}, but removing the braces and the text between them solved my problem (just new char['size'];)

answered Jun 19, 2022 at 16:38

Vlad Hagimasuri's user avatar

Another fix on Windows 10 if you have WSL installed is to disable LxssManager service and reboot the PC.

answered Aug 21, 2022 at 19:10

Vaan's user avatar

I have just upgraded Microsoft Visual Studio Enterprise 2015 from Update 2 to Update 3 and now I am getting the following error:

fatal error C1001: An internal error has occurred in the compiler.
(compiler file ‘f:ddvctoolscompilerutcsrcp2wvmmdmiscw.c’, line 2687)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information

The location is the first line which includes a header. The project has settings

/FR»x64Debug» /GS /W3 /Zc:wchar_t /Zi /Od /Fd»x64Debugvc140.pdb»
/Zc:inline /fp:precise /D «WIN32» /D «_DEBUG» /D «_WINDLL» /D
«_UNICODE» /D «UNICODE» /errorReport:prompt /WX- /Zc:forScope /clr
[some /FU»…»] /MDd /Fa»x64Debug» /EHa /nologo /Fo»x64Debug»
/Fp»….pch»

How do I make my project build again?

Leo Chapiro's user avatar

Leo Chapiro

13.5k7 gold badges60 silver badges92 bronze badges

asked Jul 8, 2016 at 11:59

MciprianM's user avatar

4

C1001 basically indicates a compiler crash, i.e. you might have created valid C/C++ code that triggers a bug in the VC compiler. It would probably be a good idea to submit a bug report via https://connect.microsoft.com/VisualStudio/Feedback for further investigation by Microsoft.

I myself just ran into a C1001 while compiling OpenCV with Visual Studio Express 2015 Update 3. In my case, the C1001 error message also pointed me to the OpenCV core code line that triggers the compiler crash. After looking into the actual code semantics at that particular line, I suspected the compiler’s floating point handling to be the root cause of the issue. It was dealing with a big, hard-coded double array lookup table which might have caused rounding issues. (Just in case somebody googles for this, I am listing the reference here: opencv_core, mathfuncs_core.cpp, line 1261, macro-expansion of LOGTAB_TRANSLATE).

In my case, setting the compiler’s floating-point model from ‘precise’ to ‘strict’ resolved the C1001 issue. However, as you haven’t included a code fragment of the lines that cause the C1001 to raise, it’s difficult to say whether the above will fix your issue as well. If you want to give it a try, you can find the compiler switch in your project settings / C/C++ / Code Generation tab. Instead of Precise (/fp:precise), select Strict (/fp:strict) as Floating Point Model. This change may affect the performance of your code, but should not affect its precision. See https://msdn.microsoft.com/en-us/library/e7s85ffb.aspx for further information.

answered Jul 12, 2016 at 20:51

Andreas's user avatar

1

According to visual studio developers community,
this issue was fixed and closed (on July 2019) and should not appear at latest VS version. So upgrading to the latest version should solve the issue.

However, I’ve just now upgraded my VS to the latest version (16.7.1) and I still encounter this problem getting fatal error C1001: Internal compiler error.

An edit: See the comments below, people say the issue also appears at VS 2022 17.3.6 and at VS 2019 16.9.4

Finally, the following solution worked for me:
change the optimization option (project properties->C/C++->optimization) to ‘Custom’ and at (project properties->C/C++->command line’) add additional options of ‘/Ob2, /Oi, /Os, /Oy’.

taken from: Visual studio in stuck Generating code

answered Aug 16, 2020 at 10:21

Eliyahu Machluf's user avatar

2

I have just upgraded Microsoft Visual Studio Enterprise 2015 from Update 2 to Update 3 and now I am getting the following error:

fatal error C1001: An internal error has occurred in the compiler.
(compiler file ‘f:ddvctoolscompilerutcsrcp2wvmmdmiscw.c’, line 2687)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information

The location is the first line which includes a header. The project has settings

/FR»x64Debug» /GS /W3 /Zc:wchar_t /Zi /Od /Fd»x64Debugvc140.pdb»
/Zc:inline /fp:precise /D «WIN32» /D «_DEBUG» /D «_WINDLL» /D
«_UNICODE» /D «UNICODE» /errorReport:prompt /WX- /Zc:forScope /clr
[some /FU»…»] /MDd /Fa»x64Debug» /EHa /nologo /Fo»x64Debug»
/Fp»….pch»

How do I make my project build again?

Leo Chapiro's user avatar

Leo Chapiro

13.5k7 gold badges60 silver badges92 bronze badges

asked Jul 8, 2016 at 11:59

MciprianM's user avatar

4

C1001 basically indicates a compiler crash, i.e. you might have created valid C/C++ code that triggers a bug in the VC compiler. It would probably be a good idea to submit a bug report via https://connect.microsoft.com/VisualStudio/Feedback for further investigation by Microsoft.

I myself just ran into a C1001 while compiling OpenCV with Visual Studio Express 2015 Update 3. In my case, the C1001 error message also pointed me to the OpenCV core code line that triggers the compiler crash. After looking into the actual code semantics at that particular line, I suspected the compiler’s floating point handling to be the root cause of the issue. It was dealing with a big, hard-coded double array lookup table which might have caused rounding issues. (Just in case somebody googles for this, I am listing the reference here: opencv_core, mathfuncs_core.cpp, line 1261, macro-expansion of LOGTAB_TRANSLATE).

In my case, setting the compiler’s floating-point model from ‘precise’ to ‘strict’ resolved the C1001 issue. However, as you haven’t included a code fragment of the lines that cause the C1001 to raise, it’s difficult to say whether the above will fix your issue as well. If you want to give it a try, you can find the compiler switch in your project settings / C/C++ / Code Generation tab. Instead of Precise (/fp:precise), select Strict (/fp:strict) as Floating Point Model. This change may affect the performance of your code, but should not affect its precision. See https://msdn.microsoft.com/en-us/library/e7s85ffb.aspx for further information.

answered Jul 12, 2016 at 20:51

Andreas's user avatar

1

According to visual studio developers community,
this issue was fixed and closed (on July 2019) and should not appear at latest VS version. So upgrading to the latest version should solve the issue.

However, I’ve just now upgraded my VS to the latest version (16.7.1) and I still encounter this problem getting fatal error C1001: Internal compiler error.

An edit: See the comments below, people say the issue also appears at VS 2022 17.3.6 and at VS 2019 16.9.4

Finally, the following solution worked for me:
change the optimization option (project properties->C/C++->optimization) to ‘Custom’ and at (project properties->C/C++->command line’) add additional options of ‘/Ob2, /Oi, /Os, /Oy’.

taken from: Visual studio in stuck Generating code

answered Aug 16, 2020 at 10:21

Eliyahu Machluf's user avatar

2

  • Remove From My Forums
  • Question

  • Hello

    I used Microsoft Visual Studio only one time a few years ago and I just made a small DLL. Today I tried to recompile the same library with the final scope to rebuild it on 64 bit but the surprise was that I couldn’t even recompile it on 32 bit any more because
    of the error: «Fatal Error C1001 — An internal error has occurred in the compiler.» I tested on Microsoft Visual Studio 2019.

    I looked online but I don’t know what is the problem, the error is too generic.

    I tried to run Vizual Studio 2019 as administrator — as sugested in another post here and I tried to delete the «#pragma once» as sugested

    here but the error is the same.

    I copied the project here.

    Thank you

    • Edited by

      Wednesday, October 2, 2019 10:51 AM

Answers

  • Hi Victorqedu123,

    Welcome to MSDN forum.

    I have tried to build the project you share. But it could build successfully in Visual Studio 2019 16.3.2 on my side.

    My Environment: Windows 10 1903, Visual Studio enterprise 2019 16.3.2, Visual Studio Ultimate 2013 with Update 5.

    Not sure if it is related to compatibility between old VS and new system, please download latest
    Visual studio 2013, then re-build it with win32
    bit.

    BTW, if you need to build it in visual studio 2019, please go to project properties page, then change platform toolset to «visual studio 2013(v120)», it will call VS2013 build tool to compile your project.

    Any feedback will be expected.

    Best Regards,

    Dylan 


    MSDN Community Support Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any
    compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by
      Victorqedu123
      Thursday, October 3, 2019 1:54 PM

Содержание

  1. Fatal Error C1001
  2. Неустранимая ошибка C1001
  3. Fatal error c1001 internal compiler error
  4. Answered by:
  5. Question
  6. Answers
  7. All replies
  8. Fatal error c1001 internal compiler error
  9. Asked by:
  10. Question
  11. fatal error C1001: An internal error has occurred in the compiler. (compiler file ‘msc1.cpp’, line 1325)
  12. 1 answer

Fatal Error C1001

INTERNAL COMPILER ERROR(compiler file file, line number)

The compiler cannot generate correct code for a construct, often due to the combination of a particular expression and an optimization option, or an issue in parsing. If the compiler file listed has a utc or C2 path segment, it is probably an optimization error. If the file has a cxxfe or c1xx path segment, or is msc1.cpp, it is probably a parser error. If the file named is cl.exe, there is no other information available.

You can often fix an optimization problem by removing one or more optimization options. To determine which option is at fault, remove options one at a time and recompile until the error message goes away. The options most commonly responsible are /Og (Global optimizations) and /Oi (Generate Intrinsic Functions). Once you determine which optimization option is responsible, you can disable it around the function where the error occurs by using the optimize pragma, and continue to use the option for the rest of the module. For more information about optimization options, see Optimization best practices.

If optimizations are not responsible for the error, try rewriting the line where the error is reported, or several lines of code surrounding that line. To see the code the way the compiler sees it after preprocessing, you can use the /P (Preprocess to a file) option.

For more information about how to isolate the source of the error and how to report an internal compiler error to Microsoft, see How to Report a Problem with the Visual C++ Toolset.

Источник

Неустранимая ошибка C1001

ВНУТРЕННЯЯ ОШИБКА КОМПИЛЯТОРА ( файл компилятора, номер строки)

Компилятор не может создать правильный код для конструкции, часто из-за сочетания определенного выражения и параметра оптимизации или проблемы при анализе. Если указанный файл компилятора содержит сегмент пути в формате UTC или C2, вероятно, это ошибка оптимизации. Если файл содержит сегмент пути cxxfe или c1xx или msc1.cpp, вероятно, это ошибка средства синтаксического анализа. Если файл с именем cl.exe, другие сведения отсутствуют.

Часто можно устранить проблему оптимизации, удалив один или несколько вариантов оптимизации. Чтобы определить, какой вариант неисправен, удаляйте параметры по одному и перекомпилируйте, пока сообщение об ошибке не исчезнет. Чаще всего отвечают параметры /Og (глобальная оптимизация) и /Oi (создание встроенных функций). Определив, какой вариант оптимизации отвечает, вы можете отключить его вокруг функции, в которой возникает ошибка, с помощью директивы optimize pragma и продолжить использовать параметр для остальной части модуля. Дополнительные сведения о параметрах оптимизации см. в разделе Рекомендации по оптимизации.

Если оптимизация не несет ответственности за ошибку, попробуйте переписать строку, в которой сообщается ошибка, или несколько строк кода, окружающих ее. Чтобы просмотреть код так, как компилятор видит его после предварительной обработки, можно использовать параметр /P (Предварительная обработка к файлу).

Дополнительные сведения о том, как изолировать источник ошибки и как сообщить о внутренней ошибке компилятора в корпорацию Майкрософт, см. в статье Как сообщить о проблеме с набором инструментов Visual C++.

Источник

Fatal error c1001 internal compiler error

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I used Microsoft Visual Studio only one time a few years ago and I just made a small DLL. Today I tried to recompile the same library with the final scope to rebuild it on 64 bit but the surprise was that I couldn’t even recompile it on 32 bit any more because of the error: «Fatal Error C1001 — An internal error has occurred in the compiler.» I tested on Microsoft Visual Studio 2019.

I looked online but I don’t know what is the problem, the error is too generic.

I tried to run Vizual Studio 2019 as administrator — as sugested in another post here and I tried to delete the «#pragma once» as sugested here but the error is the same.

I copied the project here.

Answers

Welcome to MSDN forum.

I have tried to build the project you share. But it could build successfully in Visual Studio 2019 16.3.2 on my side.

My Environment: Windows 10 1903, Visual Studio enterprise 2019 16.3.2, Visual Studio Ultimate 2013 with Update 5.

Not sure if it is related to compatibility between old VS and new system, please download latest Visual studio 2013 , then re-build it with win32 bit.

BTW, if you need to build it in visual studio 2019, please go to project properties page, then change platform toolset to «visual studio 2013(v120)», it will call VS2013 build tool to compile your project.

Any feedback will be expected.

MSDN Community Support Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

The thing to remember is that C1001 errors should never happen. If you see one then it means that the compiler itself has a problem.

In this situation you should at least provide a bug report to the Visual Studio team, you can do this via the Send Feedback button in the top right of the Visual Studio window. You could then maybe try different versions of the C++ toolset to see if an older version works.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Источник

Fatal error c1001 internal compiler error

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Asked by:

Question

I recently switched our product over to VS2010 from VS2008. Our solution consists of several native C++ projects and some managed C++ projects that link to those native projects.

The managed C++ projects are compiled with the /clr flag, of course. However, when compiling for x64, one of the files that includes one of the boost mutex headers causes the compiler to spit out the following error:

boost_1_43_0_sdkincludeboostthreadwin32basic_timed_mutex.hpp(158): fatal error C1001: An internal error has occurred in the compiler

I’ve traced down the problem to the following piece of code in basic_timed_mutex.hpp:

When compiling for x86, I see the following warning but everything still compiles:

4>boost_1_43_0_sdkincludeboostthreadwin32basic_timed_mutex.hpp(160): warning C4793: ‘boost::detail::basic_timed_mutex::unlock’ : function compiled as native :
4> Found an intrinsic not supported in managed code

It would see the BOOST_INTERLOCKED_EXCHANGE_ADD macro causes the compiler to barf. Does anybody have any ideas on why this is, or how to fix it?

Источник

fatal error C1001: An internal error has occurred in the compiler. (compiler file ‘msc1.cpp’, line 1325)

i am using visual studio 2013 in windows 10. while compiling code i am getting fatal error.

fatal error C1001: An internal error has occurred in the compiler.
(compiler file ‘msc1.cpp’, line 1325)

Kindly look into this and do let me know the required steps to resolve the issue asap.

Perhaps the easiest solution would be to update to a supported level of VS.

1 answer

The thing that you must remember about this error is that it occurs in response to code that you write. While it is true that this is caused by a bug in the compiler, knowing how to trigger the bug is very important.
Anyway, as Barry Schwarz mentioned already, using Visual Studio 2019 16.7 would be the best option here. It has several years of bug fixes and is still being actively maintained. Visual Studio 2013 will not have any more bug fixes, so the most we could do is help you find an alternative way to do what you want without triggering C1001.
If Visual Studio 2019 16.7 still results in the C1001, then you can report it as a bug to Microsoft through Visual Studio and it will be fixed in a later version of 2019. But to make it absolutely clear, don’t expect any real fixes in 2013.

Источник

Message Text

INTERNAL COMPILER ERROR
        (compiler file 'file', line number)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information

Circumstances

Error C1001 is the main error in which the compiler admits to something having
gone wrong internally, as opposed to being wrong with what its user provided as
input or arranged as the execution environment. Moreoever, though what has gone
wrong may have been anticipated, it is highly unexpected and not easily explained.

Broadly speaking, this error’s very many possible occurrences can be attributed
to two processes: assertions and exceptions. For an assertion, the compiler anticipates
something that may go wrong. For an exception, the
compiler anticipates that something may go wrong.

Assertions

TO BE DONE

Exceptions

The value of this error when reporting an exception is greatly reduced because
although the error message does at least cite which line of the user’s source code
the compiler was grappling with at the time, the rest of the error message tells
nothing of the faulting instruction or of the nature of the fault. What is described
is not where the fault occurred but where in the compiler’s source code the compiler
got round to reporting the fault as an internal compiler error. Indeed, all “exception”
cases of error C1001 cite the same compiler file and one of just two line numbers,
namely (in version 13.00.9466)

compiler file 'msc1.cpp', line 1414

and

compiler file 'msc1.cpp', line 2844

Of these, the second has much the greater opportunity for occurrence. It also
may show as a different fatal error. Of particular significance is that if an error
has already occurred, then an exception that would otherwise have caused this case
of fatal error C1001 is instead reported as fatal error C1903.

Almost by definition, the C1001 cases that are caused by CPU exceptions are coding
errors in the compiler. Perhaps this is just so obvious it needn’t be said, at least
not directly. The product documentation manages little more than “the compiler cannot
generate correct code for a construct”, which is true, but only in the best tradition
of euphemism: it has absolutely no useful content, being trivially true of any error
that stops compilation from proceeding to successful completion, and it is doubtful
that anybody would think to write such a description except as euphemism. A frank
explanation would admit to something such as “our programmers slipped up and the
compiler has just tried to do some such rubbish as dereference a null pointer.”

It is arguable, of course, that details of the exception can have hardly any
value even to the most advanced of users. The compiler’s code has caused a CPU exception
and there is nothing the user can do about it except rewrite the code in the hope
of avoiding the compiler’s defect. The exception details are better left to those
of Microsoft’s own programmers who work on the compiler and know it well enough
for deduction of what has gone wrong in their code.

That said, the exception details are obtainable, and without having to reproduce
the exception while the compiler runs under a debugger. Instead, compile with the
(undocumented) /Bd
option to defeat the compiler’s exception handlers. The fault then passes from the
compiler as unhandled, which in practice these days leaves it to be picked up by
Dr Watson with an offer to send details to Microsoft over the Internet.

Among the known cases of the front-end C++ compiler raising error C1001 because
a coding error causes a CPU exception are:

mapnik@master and node-mapnik@master as of now.

 c:mbwindows-builds-64packagesnode-mapnikmapnik-sdkincludemapnik/symbolizer_base.hpp(104): note: see reference to function
   template instantiation 'mapnik::util::variant<mapnik::value_bool,mapnik::value_integer,mapnik::enumeration_wrapper,mapnik::valu
  e_double,std::string,mapnik::color,mapnik::expression_ptr,mapnik::path_expression_ptr,mapnik::transform_type,mapnik::text_placem
  ents_ptr,mapnik::dash_array,mapnik::raster_colorizer_ptr,mapnik::group_symbolizer_properties_ptr,mapnik::font_feature_settings>:
  :variant<const char*&,mapbox::util::detail::value_traits<T,mapnik::value_bool,mapnik::value_integer,mapnik::enumeration_wrapper,
  mapnik::value_double,std::string,mapnik::color,mapnik::expression_ptr,mapnik::path_expression_ptr,mapnik::transform_type,mapnik:
  :text_placements_ptr,mapnik::dash_array,mapnik::raster_colorizer_ptr,mapnik::group_symbolizer_properties_ptr,mapnik::font_featur
  e_settings>,void>(const char *&) noexcept' being compiled
          with
          [
              T=const char *&
          ] (compiling source file ..srcmapnik_map.cpp)
..srcmapnik_vector_tile.cpp(2706): warning C4101: 'ex': unreferenced local variable [c:mbwindows-builds-64packagesnode-mapni kbuildmapnik.vcxproj]
..srcmapnik_vector_tile.cpp(3650): fatal error C1001: An internal error has occurred in the compiler. [c:mbwindows-builds-64p ackagesnode-mapnikbuildmapnik.vcxproj]
  (compiler file 'msc1.cpp', line 1421)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information
  ..srcmapnik_vector_tile.cpp(3650): note: while compiling class template member function 'mapnik::util::variant<Image *,CairoSu
  rface *,Grid *>::variant<nullptr,mapbox::util::detail::value_traits<T,Image *,CairoSurface *,Grid *>,void>(nullptr &&) noexcept(
  <expr>)'
          with
          [
              T=nullptr
          ]
  Internal Compiler Error in C:Program Files (x86)Microsoft Visual Studio 14.0VCbinamd64CL.exe.  You will be prompted to sen
  d an error report to Microsoft later.
  INTERNAL COMPILER ERROR in 'C:Program Files (x86)Microsoft Visual Studio 14.0VCbinamd64CL.exe'
      Please choose the Technical Support command on the Visual C++
      Help menu, or open the Technical Support help file for more information
cl : Command line error D8040: error creating or communicating with child process [c:mbwindows-builds-64packagesnode-mapnikbu ildmapnik.vcxproj]

Sergey Vasiliev

  • Проблема
  • Решения
    • Использование макроса ‘PVS_STUDIO’
    • Использование рабочей версии компилятора

Несколько раз нам писали пользователи, у которых перестал работать анализ части проектов. Общей особенностью было использование директивы ‘#import’ в проблемных файлах. В данной заметке будет кратно описано, с чем связана проблема, и что делать для возобновления работы анализа.

Примечание. Данная заметка актуальна только для Windows при использовании компилятора ‘cl.exe’ для препроцессирования.

Проблема

Для поиска ошибок в коде, написанном на языках C, C++, PVS-Studio использует препроцессированные файлы. Для их получения анализатор полагается на сторонние инструменты, в частности – на компилятор cl.exe. Для указания необходимости генерации препроцессированных файлов для cl.exe используется флаг ‘/P’.

Проблема заключается в том, что, начиная с версии Visual Studio 15.8 (и соответствующей версии Visual C++ — VC++ 2017 version 15.8 v14.15 toolset), при запуске cl.exe с флагом ‘/P’ на файлах, содержащих директиву ‘#import’, в компиляторе возникает ошибка.

При этом сборка (когда компилятору не передаётся флаг ‘/P’) проходит успешно. Со стороны это может выглядеть примерно так: проект успешно собирается, но анализатор PVS-Studio не работает. Вывод анализатора на проблемных файлах будет примерно следующим:

c:program files (x86)microsoft visual 
studio2017communityvctoolsmsvc14.16.27023includecomdef.h: 
fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'msc1.cpp', line 1518)
Internal Compiler Error in c:program files (x86)microsoft visual 
studio2017communityvctoolsmsvc14.16.27023binhostx64x64cl.exe

Если вы столкнулись с такой проблемой, скорее всего, ваш проект использует Platform Toolset V141, и проблема возникла после обновления Visual Studio и соответствующих пакетов Visual C++ (и компилятора, соответственно) на более свежую версию. В итоге сборка проекта всё также проходит успешно, а вот анализ – нет.

Чтобы убедиться, что проблема действительно в компиляторе, можете попробовать выставить в настройках соответствующего проекта флаг ‘/P’ и выполнить сборку. Выставление флага: Properties|C/C++|Preprocessor|Preprocess to a File -> Yes(/P).

Кстати, про эту проблему есть отдельная тема на форуме Visual Studio: https://developercommunity.visualstudio.com/content/problem/313306/vs2017-158-internal-compiler-error-msc1cpp-line-15-1.html

Решения

К сожалению, описанная проблема до сих пор актуальна, и будет исправлена, скорее всего, только в следующем релизе Visual Studio. Однако, вы можете продолжать использовать PVS-Studio для проверки проектов, затронутых данной проблемой, с помощью небольшого workaround’а.

Использование макроса ‘PVS_STUDIO’

При вызове компилятора для препроцессирования анализатором задаётся дополнительный макрос – ‘PVS_STUDIO’. Используя этот макрос, вы можете обернуть проблемные строки кода директивой #ifdef — это позволит игнорировать их препроцессору, но при этом не затронет компиляцию кода. Как минимум, следует обернуть саму директиву ‘#import’:

#if !defined(PVS_STUDIO)
 #import
 ...
#endif

Обратите внимание, что в таком случае обёрнутая в директиву часть кода не попадёт в результирующие препроцессированные файлы. В большинстве случаев данная правка не должна повлиять на результаты анализа.

Использование рабочей версии компилятора

Примечание. Данная проблема была решена в версии компилятора в составе Visual Studio (2017) 15.9.14.

Вы можете откатиться на более старую версию компилятора (или более новую), в которой описанной выше проблемы нет (напоминаю, она появилась, начиная с VC++ 2017 Version 15.8 v14.15 toolset).

Заметьте, что Visual Studio 2017 позволяет устанавливать на систему несколько экземпляров Platform Toolset V141, что позволит, при желании, не уменьшать версию Platform Toolset в проекте.

0613_ImportCompilerInternalError_ru/image1.png

Указать необходимые для использования версии компилятора можно в файлах <VsInstanceDir>VCAuxiliaryBuildMicrosoft.VCToolsVersion.default.[txt|props], где <VsInstanceDir> — установочная директория конкретного выпуска Visual Studio.

Присылаем лучшие статьи раз в месяц

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error break not in the loop or switch context in
  • Fatal error bad response to storage command wanted 2000 ok storage got 2902 bad storage
  • Fatal error bad primary partition 0
  • Fatal error avr io h no such file or directory
  • Fatal error attempting to save in maya 2023

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии