GCC debugger stack trace displays wrong file name and line number

后端 未结 11 2046
说谎
说谎 2021-01-21 00:22

I am trying to port a fairly large C++ project to using g++ 4.0 on Mac OS X. My project compiles without errors, but I can\'t get GDB to work properly. When I look at the stack

11条回答
  •  死守一世寂寞
    2021-01-21 01:08

    See my answer here

    I have now downloaded and compiled the FreeImage sources and yes, the file b44ExpLogTable.cpp is compiled into libfreeimage.a. The problem looks like the script gensrclist.sh just collects all .cpp files without skipping the one with a main in. That script generates a file named Makefile.srcs but one is already supplied. (running it on my Leopard failed, some problem with sh - it worked if I changed sh to bash)

    Before you have changed anything this gives an a.out

    c++ libfreeimage.a
    

    The file Makefile.srcs has already been created so you should be able to remove the file b44ExpLogTable.cpp from it. Then do

    make -f Makefile.osx clean
    make -f Makefile.osx
    

    When this is done the above c++ libfreeimage.a should give the following error

    Undefined symbols:
      "_main", referenced from:
          start in crt1.10.5.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    

提交回复
热议问题