简体   繁体   中英

.so file, No Such File or directory, C++

I am building a project from an exmaple project. I have created a "HelloWorld" project just to test.h includes and.so libraries. I had some issues with.h files as I am a complete beginner at C++ and I am taking elements of a sample project to build my own. I have no issues running the windows example. I have had this running and modified it. I am currently using a BeagleBone AI board running Debian 9 as a remote server for linux debugging. I have added the Include directory to the.h files in Visual Studio and these are being recognised, I have added the.so file to the linker settings in Visual studio but I am getting no such file or directory error when building it. I have checked the project folder on the BeagleBone to make sure the file exists and it does.

I cannot figure out why the program is not seeing it when it is there. I ahve a few questions to try and get some answers on this. Please bare in mind I am new to C++ and learning as I go.

  1. Does Linux need anything installed to use.so files or should shared object files just work on linux without any other dependencies?

Below is the project and settings, if anyone has any suggestions it would be appreciated. I have used images as there is no real code in this yet, just trying to get the Shared Object file to be seen before I go any further.

File System在此处输入图像描述

Inlcude Files Which the program is seeing在此处输入图像描述

Shared Object file which is not being found在此处输入图像描述

Visual Studio Settings 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述

Linux File System From Building Project在此处输入图像描述 在此处输入图像描述 在此处输入图像描述

File Not Recignized after,oving picozense_api to Library Dependencies: 在此处输入图像描述

I assume that the shared library that is not being found by the linker is libpicozense_api.so .

Remove libpicozense_api.so from the Linker -> Input -> Additional Dependencies settings and instead, in the Linker -> Input -> Library Dependencies settings enter picozense_api . Not libpicozense_api.so .

These settings generate library options for the GCC linkage command. A library option has the form -lname . It directs the linker to search, first in the specified linker search directories ( -Ldir ) and then in the linker's default search directories, for either of the files libname.so (a shared library) or libname.a (a static library), and to prefer libname.so if both files are found in the same search directory. The IDE expects you to know that Linker -> Input -> Library Dependencies is where to specify a semi-colon seperated list of the name s that should be passed as -lname options in the linkage command. 1

An unqualified filename, like libpicozense_api.so , specified in Linker -> Input -> Additional Dependencies will simply add exactly that filename to the linkage command and then it will be found only if there is a file of that name in the directory where the command is executed, which there isn't.


[1] Operating a GCC toolchain through the medium of an IDE is fraught with gotchas like this if you don't have a grounding in how the toolchain itself works. If you lack such a grounding, you can get it fromAn Introduction to GCC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM