CMake doesn't generate vc pdb for simple test program

I am trying to use CMake on Windows 10. I create a Hello world project:


cmake_minimum_required(VERSION 3.13)

add_executable(simple-program main.cpp)


#include <iostream>

int main()
        std::cout << "Hello, World!\n";

Then I open the project with CMake gui, choose Visual Studio 10 2010 Win64 generator and get this error when trying to generate the project:

testCCompiler.c : fatal error C1033: cannot open program database 'c:\work\prj\simple-program\build\cmakefiles\cmaketmp\cmtc_983e7.dir\debug\vc100.pdb'

Full output.

As I understood the problem, due to Zi option and no Fd, which cmake sets for the sample project, the project is trying to find vc100.pdb database and there is no one because the generator didn't make it.

I've tried the x86 generator. Other cmake versions (3.6, 3.13, 3.12). And I get the same result when using the console. My VS 2010 should be ok - it generates the PDB when I create the project from it.

Thank you!

- - Source


answered 1 week ago chronoxor #1

Just build your generated project in Debug mode:

MSBuild ALL_BUILD.vcxproj /p:Configuration=Debug

If you want to create a Release and install it with PDB files just all:

list(APPEND INSTALL_TARGETS simple-program)
list(APPEND INSTALL_TARGETS_PDB simple-program)

# Install

# Install *.pdb files

Finall run CMake and build in RelWithDebInfo mode:

cmake -G "Visual Studio 10 2010 Win64"
MSBuild ALL_BUILD.vcxproj /p:Configuration=RelWithDebInfo
MSBuild INSTALL.vcxproj /p:Configuration=RelWithDebInfo

This will create simple-program.exe and simple-program.pdb files in your install dir.

answered 1 week ago Fred #2

Fatal Error C1033

This error can be caused by a disk error, a temporary lock created by an anti-virus program, a previous debugger instance that has not fully shut down, or parallel build mspdbsrv.exe processes that attempt to access the same file, among other possible causes.

NOTE: I couldn't find the error codes for VS2010 on the Microsoft website. I don't think VS2010 is supported anymore and may not make working programs on Windows 10.

answered 5 day ago NuPagadi #3

The problem was because I created build folder in WSL console. Hope it will help someone.

comments powered by Disqus