qt工程命令行运行报错

时间:2022-01-05 15:26:27

在Linux中运行程序报错,在此记录一下,方便别人也方便自己.

* ./program_name (To running the program in the terminal)

  but warning like this:
      error while loading shared libraries: *.so.56: cannot open shared object file: No such file or directory

the program told you the *.so dynamic library not found.
so, we should do like this.


general solutions:

1. ldd ./program_name           // we can see the calling relationship, find which one is not found.
2. sudo find / -name "*name*"   // find which not found dynamic library or dynamic libraries.
                                                           // if your personal computer have not the dynamic library, you can download the library.

                                                           // if your PC have the dynamic library, go to the next step.

3. cd /etc/ld.so.conf.d                   // move to the directory /etc/ld.so.conf.d

4. vim *.conf                              // create the *.conf(* is your file name) file, the file name should relationship with your project or program.
5. /home/xeast/chejian/so            // include your *.so path in this *.conf
6. sudo ldconfig                              // update the buffer of ldd
7.  ./program_name                       // to running your program.

 warning like this:
     This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".
     Reinstalling the application may fix this problem. 已放弃 (核心已转储)

 8. cp /Qt5.8.0/5.8/gcc_64/plugins/platforms /home/xeast/src/cjupgrade/build_qt5.8.0_dir     // because your program is a Qt program. so, mov    e the Qt platforms to your same level directory with your program.