Any idea about fixing this 'eclipse cdt -l error' - arduino

I am trying to link my AVR cross target application to my AVR cross target library.
The library is named Lib328P and the application is named LibTest. I have built the library and verified that the .a exists in the filesystem.
I am trying to link the library by Right clicking on the project>Clicking on C/C++ Build> Settings > AVR C++ Linker> Libraries adding Lib328P to the -l category and "${workspace_loc:/Lib328P}"
to the -L category
Here is the output to the console.
**** Build of configuration Debug for project LibTest ****
make all
Building target: LibTest.elf
Invoking: AVR C++ Linker
avr-g++ -Wl,-Map,LibTest.map,--cref -L"C:\Users\kempsa\indigo_workspace\Lib328P" -mmcu=atmega328p -o "LibTest.elf" ./something.o -lLib328P
c:/arduino-0023/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: cannot find -lLib328P
make: *** [LibTest.elf] Error 1
**** Build Finished ****
I have looked at the other posts and they suggest removing the lib and .a suffix. I am already doing that. Any help would be appreciated.
Thank you!
Sam

In your case, the linker is expecting to find the file:
C:\Users\kempsa\indigo_workspace\Lib328P\libLib328P.a
Are you sure it is present at that location? Or is it in a subfolder, possibly Release or
Debug?
This is the process that works for me:
When adding a library to be linked with your program, you make two entries. The entries are found on the project properties page by navigating to:
C/C++ Build > Settings
On the right pane, be sure to select whatever Configuration you are building at the top drop down box. (Occasionaly I make changes to the wrong configuration and wonder why those changes do not seem to occur.)
On "Tool Settings" tab is a navigation tree. On that tree, select
AVR C++ Linker > Libraries
On the right pane are two list boxes: Libraries and Libraries Path. These are where you add the two entries.
1.. In the top box, click the plus or + icon. Here you enter just the library base name. This is the library name without the "lib" and without the ".a"
For example, I have one "LibCore328v101".
That will cause the linker to look for a file "libLibCore328v101.a"
2.. In the bottom box, click the plus or + icon. Here you add the path to find that library file.
2a. You can simply type the path to the folder that contains the .a file.
2b. You can click the Workspace... button and navigate to the folder that contains your library. If you keep your libraries and programs in the same workspace this is a better method to specify a path. I use this, in in my example this text is created
"${workspace_loc:/LibCore328v101/Release}"
This is essentially a relative path to the library. This means you can create an entire duplicate of your workspace and all the library includes will still be correct.
When you see the linker output in the console window, you should see both options. In my example these are:
-lLibCore328v101 (lower case ell)
-L"F:\arduino-src\tt-wb-trunk-hg\LibCore328\Release" (upper case ell)
You can see that the Eclipse plugin has converted the relative path to the current absolute path. The linker will internally add the "lib" and ".a" to the library name.
You can repeat this process adding as many libraries and paths as needed.
For your multi-target programs, you create a different configuration for every build target. So instead of Debug and Release, you have "DebugNano" "DebugTiny", etc. For each configuration, change the path to the library.

Related

How to prevent absolute paths in dynamic linker

I have a solution with various projects, one of which is the main executable, and the rest are libraries the executable depends on. Each one compiles and links fine. However, trying to start the executable gives weird results. Using ldd, I see that the executable is trying to find libraries like so:
../bin/debug/libBlahBlah.so => not found
However, for each project, I'm declaring "bin/debug" (which is the output directory for these libraries) as a libdirs entry, and linking against the library by adding "BlahBlah" as a link, where "BlahBlah" is the name of the project.
I'm not even sure how to accomplish this without premake. Any help is appreciated.
The original intention was to have the library sit next to the executable then set an RPATH that searched for the library next to executable. With the way it is now, it searches for that absolute path relative to the executable... I cannot figure out how to get it off.
I'm using premake5. I've tried to use the nightly and compiling myself. Upstream is currently not compiling however.
If you are using the latest alpha or source of Premake5, you can use the "RelativeLinks" flag to use -L/-l instead of relative paths to libraries:
project "MyProject"
flags "RelativeLinks"
You will still need to set up the rpath properly though; you can do that with buildoptions() and the appropriate command line flags for your compiler. Maybe (untested):
buildoptions "-Wl,-rpath=."
That should work in Premake 4 as well.

Add application icon to air app while packaging with adt.jar: how to?

I built air app with icon in the past with flash builder, and everything was fine.
Now I have to build another app with adt(air developer tool), but I experience weird problems.
If I just place icon path relative to 'src' folder to app descriptor (as usual), it says:
error 303: Icon icon.png is missing from package.
If I use icon.png without path in app descriptor and then put this file everywhere(to root dir, to assets, to src, to build destination and so on), it again says error 303: Icon icon.png is missing from package.
If I try to add icon path to adt args like <arg value="icon.png"/> ( and put it to output folder as it seems that all path are relative to it in my case), it says The path icon.png is restricted. If you were trying to package Icon.png you should correct the case.
When I point to original file location ( <arg value="../src/assets/icon.png"/>), it outputs File ..\src\assets\icon.png is not relative to directory E:\projQ\flex\MyProject\bin (this bin directory is actually output directory). I've read unapproved comment on adobe forum that this is due to some sandbox limitations, but I'm not even sure that sandbox exists for adt( if it exists, then why? )
So, what shall I do to successfully add icon to that app?
I guess that using tools like resHacker to project's .exe will not help as .exe is just a launcher for .swf file, and anyway I consider that this awful way leads to the dark side of programming.
(P.S. can't add 'adt' tag that relates to adobe, not android.)
Nice. At last I've found the solution. So, the requirements for including icon while packaging manually with adt are:
Add file name to application descriptor without using any .. .
I beg you, don't even try to name your icon file icon.png. It is obvious name, and it was obvious for creators of adt. So it seems that they are renaming some files to icon.png or generating output to such file. Or put this file into some subdirectory of directory that is used as root by adt. Actually, error output exactly tells you to avoid using path icon.png. Correct the case phrase (which confused me) means rename your icon or move it deeper in directory hierarchy
Add path to your icon as command line argument to adt.
After generation you will see your icon inside generated output folder. You can remove it and application will still appear with your icon as expected.
This is more of an elaboration on the first point in the answer above to clarify for people like me who have been struggling with this issue.
The error reads "is not relative to directory", but what it means is "is not a child of directory". Basically even if you're trying to use a valid relative path, it expects it to point to something under your working directory. In my case the following trick worked:
./../..build/executable.swf
Replaced with
-C ./../.. build/executable.swf
-C makes ADT change directory to the one two levels above, and then you can specify the necessary file.
After playing with ADT a bit more, I now realise why it does that - the path you give to it will become the path within the package. So in the example above the file will be available inside the package at build/executable.swf. If you wish to make it available at package's root level, change the -C directive to the following:
-C ./../../build executable.swf

Undefined references - I'm including correct header

I'm trying to subclass from ProjectExplorer::ProjectExplorerPlugin but I'm getting error telling me about undefined references. Any ideas how to fix it?
class MyPluginPlugin : public ProjectExplorer::ProjectExplorerPlugin
{
Q_OBJECT
...
};
error: undefined reference to `imp__ZN15ProjectExplorer21ProjectExplorerPluginC2Ev'
The fact that you don't get a compilation error, but an undefined reference usually means that your project knows where the header files are, but it doesn't know where the library is which contains the already compiled source code.
I've never written a plugin for Qt Creator but I've taken a quick look at its source code structure and I see the following options:
Option A)
There is a projectexplorer.pro file in Qt Creator's source under src/plugins/projectexplorer. You could manually build that project in order to get a ProjectExplorer.lib (plus a .dll or a .a) and then reference this library.Example: Assuming the library would be created in the same directory as its .pro file (I have no idea if it is like that) and you created your plugin withing Qt Creator's source under src/plugins/myplugin, you would define your LIBS variable like this:
LIBS += -L../projectexplorer \
-lProjectExplorer
The first line adds "../projectexplorer" as an additional library directory and the second line adds "ProjectExplorer" as a library to search in any of the defined directories (it automatically adds the OS-specific file extensions like .lib on windows etc).
Obviously if your project or the library is located somewhere else, you need to change the first line accordingly.
Option B)
You could include the source and header files of the projectexplorer directory to your own .pro file using the HEADERS and SOURCES variables. I'm not sure if this wouldn't interfere with any other plugins (including projectexplorer itself) though.
Option C)
There probably is a way to include the projectexplorer.pro file so that you have a master project which first builds the project explorer library and then your own plugin. This would be the safest way to go as it ensures the Project Explorer library is built and up-to-date before your own project is linked against it.
However I have limited experience on this.
If anyone reading this can give a detailed explanation on this option, feel free to edit or provide your own answer.
If you are using Qt Creator built from source coded after April 2013 which includes Commit: #66a3553 - make library and plugin dependencies declarative, then you can simply specify dependencies for your plugin in its .pro file:
# myplugin.pro
QTC_PLUGIN_DEPENDS += \
coreplugin \
projectexplorer

how to add the ahven framework

I just installed ahven, but if I compile a testprogram with Ahven.Framework,
I always get a compiler error:
file "ahven.ads" not found
My files for ahven are just here:
/opt/ada/include/ahven/ahven.ads
/usr/share/ada/adainclude/ahven/ahven.ads
how can I tell gnat where to search?
Edit:
I'm using gnatmake on Linux, without any project file.
There's an ahven.gpr file, which should take care of the dependencies. Find where that file was placed, and then either add a reference to it in your project's .gpr file, or if you're using the gps IDE, right-click on the project name, select Project/Dependencies, and then do "Add From File".
Assuming you are using gnatmake and a unix/linux based system, You need to add a path to your gnatmake command. To look up how to do this type gnatmake and look for the -I option in the help screen that follows. Im not sure which one of your dirs would be appropriate to include. That should be found in your ahven documentation.

Qmake does not support build directories below the source directory

I have created an application that compiles and runs like a charm on OS-X. I would now like to start getting it to work on Windows. To start, I copied the project to a windows machine and just tried to compile, but got this error:
:: warning: Qmake does not support build directories below the source directory.
Any ideas?
Set the shadow build directory to some folder on the same level of your project directory:
folder/
project/
project-shadow-build-release/
project-shadow-build-debug/
You can do this in the "Projects" view, via the toolbar on the left. To me, this warning was just an annoyance, a project never failed to build because of it.
Don't copy your project.pro.user file when you are copying a project from one machine to another, or from one directory to another. When you open the project, Qt Creator will offer to create a new build directory in the proper place.
Andref gave the correct answer to resolve this warning, but you may want to understand why this requirement exists.
In fact, the build directory must be at the same folder level as the project (i.e. it can't be above or below). The reason why is that the linker is called from the build directory. Hence, any relative paths to library files will be different than what you entered in your project file.
It kinda sucks. I like to put all intermediate files in their own folder. But you simply can't with qmake.
.pro.user are generated files by Qt Creator. They are unrelated to qmake and should not be touched (and not put into a VCS for that matter)
Just remove the files with the pro.user extension , worked for me
I also got this, trying to compile a project created on linux.
Another way to solve it is to change the paths in the .pro.user file (in the directory of your project)
Right Click on a project: Set As Active Project
Click on the Projects button (The one with the spanner image)
Edit build configuration : Debug / Profile / Release / and change the default directories, OR just uncheck the Shadow build check box.
The Build directory path should now change to black, from red

Resources