Unexpected pdb error ok 0

When compiling a large C++ project with VS 2012 I periodically get this error:
  • Remove From My Forums
  • Question

  • When compiling a large C++ project with VS 2012 I periodically get this error:

    error LNK1318: Unexpected PDB error; FORMAT (11)

    The error goes away if I rebuild the non-linking projects again. What does this error mean? I could not find any documentation on the subject. Is it a bug in the linker or, perhaps, an indication of disk failure? It’s a brand new disk and I never saw any
    other indication of potential failure than this error.

    Please advise.

Answers

  • Hi,

    Could please tell us what the concrete edition of Visual Studio 2012 you are using ?

    Did this error happen in both Release mode and Debug mode ?

    Did it trouble other kinds of C++ projects?

    You can take a look at the following explaination and workaround below:

    «the cause of this error (nafxcw.lib(objcore.obj) : fatal error LNK1318: Unexpected PDB error; OK (0) ) is that when a solution contains several
    projects with conflicting settings, such as multi thread vs single thread settings. What solved the problem was setting the
    same value for the setting:

    Project Properties->Configuration Properties->C/C++ -> Code Generation -> Enable Function-Level Linking.»

    For more details, please check  the  similar topic

    LINK : fatal error LNK1318 .

    If this error remains unresolved, please feel free to let me know and provide more details about this project for further analysis.

    Sincerely,

    Jane.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click
    HERE to participate the survey.

    • Marked as answer by

      Saturday, January 25, 2014 8:51 PM

RangoM

1

27.05.2011, 12:32. Показов 4775. Ответов 12


При компиляции (VS2010) возникает такая ошибка:

fatal error LNK1318: Unexpected PDB error; OK (0) »

как можно её исправить?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

fritt

12.05.2013, 19:14

2

В папке с проектом из debug удалить файл .pdb, он создаст новый.
Это, как я понимаю, произошло после изменений в программе, не совместимых с предыдущими её версиями

9 / 9 / 3

Регистрация: 01.04.2009

Сообщений: 436

08.11.2014, 10:54

3

Та же самая ошибка. Удалял pdb, удалял весь проект, перезагружал комп, ошибка все равно остается.
Visual С++ 2008 Express



0



9 / 9 / 3

Регистрация: 01.04.2009

Сообщений: 436

08.11.2014, 11:34

5

У меня XP.
А что, на 2008 с этой ошибкой так никому и не удалось ничего написать, исправили ее только на 2010?

Добавлено через 1 минуту
Я проделывал все что по той ссылке, я ее в поисковике находил. Ничего не помогло.



0



:)

Эксперт С++

4773 / 3267 / 497

Регистрация: 19.02.2013

Сообщений: 9,046

08.11.2014, 11:45

6

Цитата
Сообщение от Viktor2004
Посмотреть сообщение

на 2008 с этой ошибкой так никому и не удалось ничего написать,

Почему же?
https://social.msdn.microsoft…. vclanguage
Попробуйте убить mspdbsrv.exe процесс. Если он присутствует конечно.

Цитата
Сообщение от Viktor2004
Посмотреть сообщение

У меня XP.

Сочувствую.



0



9 / 9 / 3

Регистрация: 01.04.2009

Сообщений: 436

08.11.2014, 12:01

7

Цитата
Сообщение от Tulosba
Посмотреть сообщение

Попробуйте убить mspdbsrv.exe процесс. Если он присутствует конечно

Тоже уже искал. Нет у меня ни такого процесса, ни файла вообще на компе.

Добавлено через 7 минут

Цитата
Сообщение от Tulosba
Посмотреть сообщение

Сочувствую.

Ноутбук у меня старенький. С предустановленной Вистой еще шел. Виста слетела в первый же день, пришлось XP ставить.



0



:)

Эксперт С++

4773 / 3267 / 497

Регистрация: 19.02.2013

Сообщений: 9,046

08.11.2014, 12:08

8

Viktor2004, если проблему не удается решить, могу посоветовать переключится на другую IDE.



0



Viktor2004

9 / 9 / 3

Регистрация: 01.04.2009

Сообщений: 436

08.11.2014, 12:11

9

Цитата
Сообщение от Tulosba
Посмотреть сообщение

Viktor2004, если проблему не удается решить, могу посоветовать переключится на другую IDE

Я уже пробовал Borland Там ничего не получилось и мне посоветовали поставить Visual
Может проблема в моей программе?

C++
1
2
3
4
5
#include<iostream>
int main()
{
    system ("pause");
}

Именно она нигде не хочет работать.
Может есть программка попроще?



0



Tulosba

:)

Эксперт С++

4773 / 3267 / 497

Регистрация: 19.02.2013

Сообщений: 9,046

08.11.2014, 12:19

10

Цитата
Сообщение от Viktor2004
Посмотреть сообщение

Я уже пробовал Borland

В топку борланд.
Попробуйте выбрать из этого списка: Бесплатные среды (IDE) для программирования на С/С++
Я бы посоветовал Qt.

Цитата
Сообщение от Viktor2004
Посмотреть сообщение

Может есть программка попроще?

C++
1
int main() { }

Для вызова system() нужно подключить

C++
1
#include <stdlib.h>

Но правильнее всё же использовать std::system() и <cstdlib>



0



9 / 9 / 3

Регистрация: 01.04.2009

Сообщений: 436

08.11.2014, 12:29

11

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



0



16495 / 8988 / 2205

Регистрация: 30.01.2014

Сообщений: 15,611

08.11.2014, 12:31

12

Цитата
Сообщение от Viktor2004
Посмотреть сообщение

Может проблема в моей программе?

Из реальных проблем тут только одна: в заголовочном файле iostream нет прототипа system, он определеяется в <cstdlib>
Но ошибка твоя конечно же не из-за этого. Я думаю это из-за перекряченной portable версии. Качал ее поди с торрентов?
Правильный способ — это скачать версию express edition c официального сайта.



0



9 / 9 / 3

Регистрация: 01.04.2009

Сообщений: 436

08.11.2014, 14:56

13

Цитата
Сообщение от DrOffset
Посмотреть сообщение

Правильный способ — это скачать версию express edition c официального сайта.

Спасибо. Скачиваю.

Добавлено через 2 часа 18 минут
Установил. Ошибка пропала.
Спасибо Вам большое



0



Expected behavior

Run MSBuild to compile a VC++ project file in windowsservercore

Actual behavior

LNK1318: Unexpected PDB error; RPC (23) ‘(0x000006E7)’

Information

I am trying to build some C++ programs in windows containers, therefore I’m using the latest windowsservercore image as a base and then I install the VC++ 2015 Build tools from here.

The Dockerfile looks something like this:

FROM microsoft/windowsservercore:latest

# install MSBuild & C++ build tools
RUN Invoke-WebRequest "http://go.microsoft.com/fwlink/?LinkId=691126" 
    -OutFile visualcppbuildtools_full.exe -UseBasicParsing ; 
    Start-Process -FilePath 'visualcppbuildtools_full.exe' -ArgumentList '/quiet', '/NoRestart' -Wait ; 
    Remove-Item .visualcppbuildtools_full.exe

# MSbuild path
RUN $env:PATH = 'C:Program Files (x86)MSBuild14.0Bin;'+$env:PATH; 
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);

When I then try and run MSBuild on a VC++ .sln file…
(I reproduced this with just an empty Win32 Console App template)

msbuild VCppTestApp.sln /t:Rebuild /property:Configuration=Release

then I get the following error:

Microsoft Windows [Version 10.0.14393]
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 6/11/2017 6:56:42 PM.
Project "C:j2v8VCppTestAppVCppTestApp.sln" on node 1 (Rebuild target(s)).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
Project "C:j2v8VCppTestAppVCppTestApp.sln" (1) is building "C:j2v8VCppTestAppVCppTestAppVCppTestApp.vcxproj" (2) on node 1 (Rebuild target(s)).
CoreClean:
  Creating directory "x64Release".
PrepareForBuild:
  Creating directory "C:j2v8VCppTestAppx64Release".
  Creating directory "x64ReleaseVCppTestApp.tlog".
InitializeBuildStatus:
  Creating "x64ReleaseVCppTestApp.tlogunsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:Program Files (x86)Microsoft Visual Studio 14.0VCbinx86_amd64CL.exe /c /Zi /nologo /W3 /WX- /sdl /O2 /Oi /GL /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Yc"stdafx.h" /Fp"x64ReleaseVCppTestApp.pch" /Fo"x64Release\" /Fd"x64Releasevc140.pdb" /Gd /TP /errorReport:queue stdafx.cpp
  stdafx.cpp
  C:Program Files (x86)Microsoft Visual Studio 14.0VCbinx86_amd64CL.exe /c /Zi /nologo /W3 /WX- /sdl /O2 /Oi /GL /D NDEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Yu"stdafx.h" /Fp"x64ReleaseVCppTestApp.pch" /Fo"x64Release\" /Fd"x64Releasevc140.pdb" /Gd /TP /errorReport:queue VCppTestApp.cpp
  VCppTestApp.cpp
Link:
  C:Program Files (x86)Microsoft Visual Studio 14.0VCbinx86_amd64link.exe /ERRORREPORT:QUEUE /OUT:"C:j2v8VCppTestAppx64ReleaseVCppTestApp.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:j2v8VCppTestAppx64ReleaseVCppTestApp.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG:incremental /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:j2v8VCppTestAppx64ReleaseVCppTestApp.lib" /MACHINE:X64 x64Releasestdafx.obj
  x64ReleaseVCppTestApp.obj
  Generating code
  All 5 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  Finished generating code
LINK : fatal error LNK1318: Unexpected PDB error; RPC (23) '(0x000006E7)' [C:j2v8VCppTestAppVCppTestAppVCppTestApp.vcxproj]
Done Building Project "C:j2v8VCppTestAppVCppTestAppVCppTestApp.vcxproj" (Rebuild target(s)) -- FAILED.
Done Building Project "C:j2v8VCppTestAppVCppTestApp.sln" (Rebuild target(s)) -- FAILED.

Build FAILED.

"C:j2v8VCppTestAppVCppTestApp.sln" (Rebuild target) (1) ->
"C:j2v8VCppTestAppVCppTestAppVCppTestApp.vcxproj" (Rebuild target) (2) ->
(Link target) ->
  LINK : fatal error LNK1318: Unexpected PDB error; RPC (23) '(0x000006E7)' [C:j2v8VCppTestAppVCppTestAppVCppTestApp.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:09.17

I’m trying to link against a library (libcef_wrapper_dll.lib) that was built with the /MDd flag. My application is build with /MDd and /CLR so should be compatible. The project compiles fine but when linking I get the very unhelpful error below:

   Error    1   fatal error LNK1318: Unexpected PDB error; OK (0) ''    c:ProjectsCefCefSharplibcef_dll_wrapper.lib 1   CefSharp

I don’t have a .PDB file for the .LIB, do I need one?

11 Answers

Turned out that I needed to delete all of the project temp files inc. caches etc., kill the debug symbol server and restart windows.

I’ve seen LNK1318: Unexpected PDB error; UNKNOWN (24) when linking.

It happened when I had more than two links of large outputs happening at once — mspdbsrc.exe used more and more memory, hit 2gig or so, then crashed.

This one worked for me:
Project properties -> C/C++ -> Code Generation -> Enable Function Level Linking -> Yes

Rebuilding the project solved the problem

Best solution for me has always been to simply kill the symbol server. I have a batch file on my desktop to do this:

@for /F "tokens=2 delims= " %%I in ('tasklist^|findstr /I "mspdbsrv.exe"') do taskkill /F /PID %%I>NUL && echo Process killed.

This is a technical limitation of the VC linker.
You should try split your code modules up more. Splitting up libraries also help with extremely long link times.

See if you can successfully build on release mode

I had the problem because I had a file with the /clr option that was messing things up. I moved the CLR specific code to a separate file, cleaned, rebuilt and the problem is gone.

This worked for me: Go to Project properties -> C/C++ -> Code Generation ->Runtime Library->Multi-threaded Debug (/MTd).

this looks to be some incredibuild issue.
refer: https://incredibuild.force.com/s/article/fatal-error-LNK1318-unexpected-PDB-error-OK-0

Fatal error LNK1318: Unexpected PDB error; OK (0)
Content

—> This error may occur in a random manner — usually when building large Solutions.

There are 2 ways solving your LNK1318 error:

1. Switching to the old PDB method - C7 (/Z7) since this error seems to invoke when the regular "PDB for Edit And Continue" option is enabled.
2. Switching to 64-bit native compiler. You can enable the 64bit native compiler using Agent Settings -> Visual Studio Builds -> Advanced. Under the "PDB File Allocation" please mark the "Force 64-bit toolset".
Thread overview
compiler fails with fatal error LNK1318: Unexpected PDB-error: OK (0) «»

Jan 03, 2022

Simon

Jan 03, 2022

Simon

Jan 03, 2022

Simon

Jan 04, 2022

russhy

Jan 04, 2022

frame

January 03, 2022

compiler fails with fatal error LNK1318: Unexpected PDB-error: OK (0) «»

Gravatar of Simon Posted by Simon PermalinkReply
Gravatar of Simon

PermalinkReply

When compiling my project using v2.098.0 or v2.098.1 on Windows 10, this error just appeared:

: fatal error LNK1318: Unerwarteter PDB-Fehler: OK (0) «».
Error: linker exited with status 1318

«Unerwarteter PDB-Fehler» means «Unexpected PDB-error». The next 3 attempts to compile yielded the following errors:

libucrtd.lib(lseek.obj) : fatal error LNK1318: Unerwarteter PDB-Fehler: OK (0) «».
Error: linker exited with status 1318

libucrtd.lib(initcon.obj) : fatal error LNK1318: Unerwarteter PDB-Fehler: OK (0) «».
Error: linker exited with status 1318

libucrtd.lib(round.obj) : fatal error LNK1318: Unerwarteter PDB-Fehler: OK (0) «».
Error: linker exited with status 1318

The obj file reported seems to pretty much be picked at random. In the first error message there simply was no lib/obj mentioned. This issue started appearing today, without installing any updates (to any program at all). The PC wasn’t even shut down since yesterday, when everything worked fine. Restarting doesn’t help, removing all obj files and doing a full rebuild also doesn’t help (I have obj files built by MSVC that also get linked). I was on v2.098.0 before, then upgraded in hopes of fixing the issue. The very first compile after upgrading to v2.098.1 worked, every consecutive compile after that is broken again.

January 03, 2022

Re: compiler fails with fatal error LNK1318: Unexpected PDB-error: OK (0) «»

Gravatar of Simon Posted by Simon
in reply to Simon
PermalinkReply

Simon

Gravatar of Simon


Posted in reply to Simon

PermalinkReply

Forgot to mention: I’m using DMD, and the Windows 10 is 64 bit.

January 03, 2022

Re: compiler fails with fatal error LNK1318: Unexpected PDB-error: OK (0) «»

Gravatar of Simon Posted by Simon
in reply to Simon
PermalinkReply

Simon

Gravatar of Simon


Posted in reply to Simon

PermalinkReply

OOOOoops this went into the wrong forum! Sorry! I will repost this as a compiler issue, any moderator feel free to delete this post.

January 04, 2022

Re: compiler fails with fatal error LNK1318: Unexpected PDB-error: OK (0) «»

Gravatar of russhy Posted by russhy
in reply to Simon
PermalinkReply

russhy

Gravatar of russhy


Posted in reply to Simon

PermalinkReply

On Monday, 3 January 2022 at 09:20:57 UTC, Simon wrote:

>

OOOOoops this went into the wrong forum! Sorry! I will repost this as a compiler issue, any moderator feel free to delete this post.

Are you using dub? if the problem appeared over night, then it sounds like a cache issue, probably due to windows antivirus

dub clean and delete the .dub folder, and see if that works

January 04, 2022

Re: compiler fails with fatal error LNK1318: Unexpected PDB-error: OK (0) «»

Gravatar of frame Posted by frame
in reply to Simon
PermalinkReply

frame

Gravatar of frame


Posted in reply to Simon

PermalinkReply

On Monday, 3 January 2022 at 09:20:57 UTC, Simon wrote:

>

OOOOoops this went into the wrong forum! Sorry! I will repost this as a compiler issue, any moderator feel free to delete this post.

I got a similar issue once if a process (symbol server registry or something) locked the PDB files and the linker wasn’t able to update the file but silently ignores it.

However, this doesn’t smell like a compiler issue. Manually removing all PDB files could help. Those may are cached in some temp folders outside the project too.

Я пытаюсь связать библиотеку (libcef_wrapper_dll.lib), которая была создана с флагом /MDd. Мое приложение построено с /MDd и /CLR, поэтому должно быть совместимо. Проект компилируется нормально, но при связывании я получаю очень бесполезную ошибку ниже:

   Error    1   fatal error LNK1318: Unexpected PDB error; OK (0) ''    c:ProjectsCefCefSharplibcef_dll_wrapper.lib 1   CefSharp

У меня нет файла .PDB для .LIB, нужен ли он мне?

10 ответы

Оказалось, что мне нужно удалить все временные файлы проекта, в т.ч. кеши и т. д., уничтожьте сервер символов отладки и перезапустите окна.

Создан 24 фев.

Я видел LNK1318: непредвиденная ошибка PDB; UNKNOWN (24) при связывании.

Это произошло, когда у меня было более двух ссылок на большие выходные данные одновременно — mspdbsrc.exe использовал все больше и больше памяти, достиг 2 гига или около того, а затем разбился.

ответ дан 16 дек ’11, 12:12

Это сработало для меня: Свойства проекта -> C/C++ -> Генерация кода -> Включить связывание на функциональном уровне -> Да

ответ дан 10 мар ’14, в 11:03

Перестройка проекта решила проблему

Создан 06 июн.

Лучшим решением для меня всегда было просто убить сервер символов. У меня есть пакетный файл на моем рабочем столе, чтобы сделать это:

@for /F "tokens=2 delims= " %%I in ('tasklist^|findstr /I "mspdbsrv.exe"') do taskkill /F /PID %%I>NUL && echo Process killed.

ответ дан 07 дек ’16, 07:12

Создан 13 июн.

Это техническое ограничение компоновщика VC. Вы должны попробовать разделить свои модули кода больше. Разделение библиотек также помогает при очень длительном времени компоновки.

Посмотрите, сможете ли вы успешно использовать режим выпуска

Создан 14 янв.

При использовании /MP or /MDd с MSBuild также используйте /Zf вариант компилятора. (Видеть https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk1318 )

Другие шаги по устранению неполадок для LNK1318:

  • Сделайте полную очистку/восстановление
  • Перезапустите mspdbsrv.exe
  • Отключите антивирусные проверки в каталогах вашего проекта.
  • Изменить Debug Information Format в /C7 or None
  • Попробуйте построить с /property:_IsNativeEnvironment=true

Создан 22 июн.

У меня была проблема, потому что у меня был файл с параметром /clr, который все портил. Я переместил код CLR в отдельный файл, почистил, пересобрал, и проблема исчезла.

ответ дан 29 окт ’13, 18:10

Это сработало для меня: перейдите в свойства проекта -> C/C++ -> Генерация кода -> Библиотека времени выполнения -> Многопоточная отладка (/MTd).

Создан 27 фев.

Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками

visual-studio
linker
c++-cli

or задайте свой вопрос.

Понравилась статья? Поделить с друзьями:
  • Unexpected matlab expression как исправить
  • Unexpected mark stack overflow как исправить
  • Unexpected mark stack overflow fatal error in gc
  • Unexpected error detected check the tests output pane for details
  • Unexpected indentation как исправить