Make host application to see .so library while debugging - c++

Trying to debug .so library from Eclipse C++ project under Linux. I have selected host application, but unfortunately host application is trying to find library in projects directory and not in Debug folder under it. And even I place host app in Debug folder it still search in project root folder. How to solve this problem?

Try to change the "Working directory" option under the "Arguments" tab of the debug configuration.
In general, in Linux the libraries are normally searched in LD_LIBRARY_PATH (which you can also try to override under the "Environment" tab but beware to keep the standard library paths there as well). And to load a so library from the current working dir, the LD_LIBRARY_PATH needs to contain the dot '.' path (which is not always the case - sometimes it is not included for security reasons).

Go to "Debug Configurations" from the pull-down here:
Then select your program in the left hand list and on the right select the "Environment" tab.
There you need to add a new environment variable called LD_LIBRARY_PATH. Its value should be the path to your library. If you have more than one library add their paths in a colon : separated list.

Related

Eclipse C++ in Clearcase vobs: Unresolved inclusion

I would like to get your thoughts on why I am getting an "unresolved inclusion" error for certain .h files included as part of my project.
I actually cloned the project from another existing project, by simply copying, pasting and renaming.
Inside the cloned project, which originally had only a src/ directory, I also created a tst/ directory and did right-click->New->Folder and from the menu, clicked on Advanced >> and selected "Link to alternate location (Linked Folder)" and browsed to the relevant path under /vobs to add the source folder to my project.
Once I did this, the indexer started rebuilding the index, at the end of which I got the above mentioned inclusion errors.
The .h files could be located inside a specific folder path under /vobs; I first tried including this path by right-clicking on the cloned project and choosing Properties->Paths and Symbols->Includes to update the include list with the folder path. This didn't resolve the error.
Subsequently, I tried repeating the above procedure for the newly created tst/ directory from within the project; that didn't resolve the error either.
Not sure what is it that I am missing here.
Any suggestions would be appreciated.
Check first if those files are there, in your view. '/vob' could mean dynamic view, mounted under /vob.
I would rather work with a snashot view, which would download those same files on disk (rather than using the MVFS, Multi-Version FileSystem of a dynamic view).
Then, when you are sure the files are there, and cleartool ls shows them correctly loaded, you can double-check your inclusion paths, as mentioned here
"unresolved inclusion" means the file can't be found.
This means the directory containing it hasn't been specified to CDT or it has been misspelled.
If spelled correctly, normally you would specify the path with Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. on the Entries tab as a user entry.
Note that it depends on the type of project.
When you select File --> New -> C/C++ Project you are presented with various options.
The options are for the kind of builder used.
Some, such as Meson, Qt , Arduino and maybe others don't have the option "Preprocessor" option.
My guess is that you are not set in a view when you start Eclipse. This will prevent resolution of the the absolute "/vobs/..." paths. If you start Eclipse from GNOME (or any other windowed environment) the current working directory of Eclipse is likely your home directory. Without a view context, the /vobs/... paths will not contain any files under source control.
You COULD use /view/myview/vobs/myvob/... in the include paths, but that would mean EVERYONE who would use the project would have to either start your view or create and start an identically named one... And that's just the start of that particular can of worms.
You may want to confirm how Eclipse handles relative paths in the include path. Do they start from the current working directory of Eclipse? The project home directory? Somewhere else? That may give you a safe view-independent way to specify your include paths.
I would try setting a view and starting Eclipse from within the subshell spawned by cleartool setview. Then verify whether the includes are accessible.

visual studio c++ project cannot find .dll

I have downloaded the Autodesk fbx sdk and trying to build a simple console app. I have added additional directories in Linker / General / Additional Library Directories like follows:
see the screenshot of the directory below. There are several libs that (I suppose) I should add in dependencies, and there's also the .dll file. It's release folder (debug is another available), for x86 architecture and for VS2017 which I am using.
Also, I have add dependencies like below and have included the standard include folder as specified in the Autodesk manual
The project builds fine but shows the following when run:
Cannot run code because libfbxsdk.dll could not be found...
But it is in the folder as you can see in the pic. Could you pls help?
The linker settings have nothing to do with finding DLL files at run-time. If you want this SDK to be available to all programs - which without reason to do otherwise would be my recommendation - hit the start button and search for "environment", choosing "Edit environment variables for your account". Edit the value of the PATH environment variable (adding it if necessary) to include the directories where the DLLs are located.
If you only want it to be available to this particualr program (and you don't have any other custom DLLs that need to be found) you could also change the startup directory in the project properties to the directory where the DLL files can be found (the startup directory is one of the locations in the system search path).

Missing xxx.dll when performing built executives in visual studio

The system warned that missing opencv_core331.dll
However, I have added the path of directory that include opencv_core331.dll to the environment variables of Windows:
Who can help?
This is a run-time issue, the libraries path has nothing to do with it. You need to either edit the global PATH variable or the executable directories in the project properties. I would personally recommend the global PATH variable because that way your program will run outside of VS as well as from it.
To do so, in the start menu search box type "environment" and select the ""Edit system environment variables" if you want to make the change for all accounts.environment variables for your account" or (

Relative path for related projects in netbeans

I have a project which is dependent on a library created from another project. While this runs in netbeans for my desktop, it does not, when i build it remotely because the related project(which i add using the properties tab, in Linker->Libraries) with the library is added with the absolute path! Is there a way to add this with relative path?
While, I have not found a proper solution to this problem, currently I am manually moving the library to the path where it is required to be, by the main project in the remote computer.

NetBeans 7 c++ remote development host include path

Maybe this is a little bit esoteric, let's see how it goes.
I'm writing a c++ program using NetBeans 7 on a Windows 7 x64 box, but building on a remote development host, which is actually an Ubuntu Server 10.4 x64 virtual machine running on VirtualBox 4.
Source files are shared using VirtualBox shared folders. I've been able to create projects, build and debug them with no problems.
However, the code assist features of NetBeans keep on complaining that none of my include files can be found, and therefore I get a code assist "unable to resolve identifier" error for every single function call.
This is not very surprising, as the include files are actually in /usr/include, which is not part of the shared folder scheme, and therefore are not directly readable by NetBeans (it can and should read them using ssh though). But I would expect for NetBeans to allow me to set remote directories for code assist. I've looked through many settings and haven't found anything resembling what I'm looking for.
Sure, it's possible to just ignore this errors, but apart from me being near-OCD, that would be the same as disabling code assist, and I really appreciate it when the IDE tells me about a typo or other things that can be done with code assist.
Any ideas?
You might want to try the following settings in Netbeans, which solved my problem of code assist on remote hosts:
1) Project Build Settings
a - Right-click on the project in the project pane, select "Properties"
b - Expand "Build" and click "C++ Compiler"
c - In the "Include Directories", make sure you set the correct Configuration (Debug or Release) at the top, click the "..." to open the "Include Directories" window
d - Put the full path of the include directory. Notice that when you click "Select", Netbeans will automatically prepend the Windows path information. Since you are developing on a remote Linux host, you must now click the "Edit" button and edit this path to resemble the Linux file path (without the C:)
2) Netbeans Code Assistance Options
a - In the Netbeans menu bar, click "Tools" and then "Options"
b - Click "C/C++" at the top, then select the "Code Assistance" tab
c - Make sure the "Tool Collection" is set to the proper remote host at the top
d - For bot the "C Compiler" tab and the "C++ Compiler" tab, click "Add" and manually type the full path to the directory you want Code Assist to index.
e - Again, when you click "Select", Netbeans will automatically prepend the Windows path PLUS change the slashes to Windows slashes (ugh)... so now you must click "Edit" and edit those paths to represent the correct Linux syntax
Hope that helps!!