vendredi 7 décembre 2018

c++ error : (1) std::shared_ptr & segmentation fault // (2) undefined reference to (global) function [on hold]

(OS : ubuntu LTS 16.04)

(Kernel : 4.15.0-42generic #45~16.04.1-Ubuntu SMP)

(g++ : ubuntu 5.4.0-6ubuntu1~16.04.10)

I had 2 troubles in this simple code.

the program structure is like this.

.
├── CMakeLists.txt
├── include
│   ├── a_f
│   │   └── AAA.hpp
│   ├── b_f
│   │   └── BBB.hpp
│   ├── c_f
│   │   └── CCC.hpp
│   ├── main_.hpp
│   └── print.hpp
├── README.md
└── src
    ├── a_f
    │   └── AAA.cpp
    ├── b_f
    │   └── BBB.cpp
    ├── c_f
    │   └── CCC.cpp
    ├── main_.cpp
    └── print.cpp

(( dependency graph ))enter code here

[ include/main_.hpp ] 
-> [ include/c_f/CCC.hpp ] 
-> [ include/b_f/BBB.hpp ] 
-> [ include/a_f/AAA.hpp ]
-> [ include/print.hpp ]

in file [main_.cpp] on line 7, I get C++ undefined reference to a "definitely defined" global function. So I decided to comment out the problematic line 7.

After doint so, I could compile the program successfully but I encountered 'segmentation fault (core dump)' error.

Can anyone explain why this code doesn't work well? Can anyone tell me how I should fix the code??

this is a hyperlink to the error code github

plz somebody help me.

Aucun commentaire:

Enregistrer un commentaire