c++linuxg++pdb-files

Generate pdb files with linux and g++


This is my makefile. I would also like to generate .pdb files. I am already using the -g option however I dont see any file created with .pdb extension. The post here also stated to use -g option.

CXX = g++
CXXFLAGS = -Wall -g

all: comment \
     test

comment:
    @echo ------Starting Build Process-----------------

test:  main.o car.o student.o   house.o 
    $(CXX) $(CXXFLAGS) -o test main.o car.o student.o house.o

main.o: student.h house.h    main.cpp
    $(CXX) $(CXXFLAGS) -c main.cpp

car.o: car.h

student.o: student.h car.h

house.o: house.h 

clean:
    rm -rf *.o test

Any suggestions on how to generate pdb files?


Solution

  • Update:

    Microsoft has open-sourced the PDB format in a github repo in 2015 (but has archived that repo in 2023 with no further updates planned).

    So it is quite possible to generate PDB with non-Microsoft tools now, though it's unclear for how long Visual Studio will continue to be able to read such PDBs.


    Original answer from 2014:

    I would also like to generate .pdb files

    You can't: the PDB file format is Microsoft-proprietary and undocumented, and thus can't be generated by non-Microsoft tools.

    Nor would the PDB file be usable on Linux. In other words, your desire to generate PDB is likely due to some lack of understanding on your part.