Ne10 not able to execute sample using gcc - c++

I need to use NEON instructions in an existing c++ code for achieving better performance on ARM platform(ARMv7 laptop running Ubuntu). After some research I found a library Ne10 which may help that purpose. Now I am stuck at this simple task of running a basic program using Ne10. I am trying to run a sample C program as given at
http://community.arm.com/groups/android-community/blog/2013/09/26/ne10-library-getting-started
I did the cmake and make successfully. The compiled files are saved inside the build folder. But I am not able to compile them using gcc. I gave the gcc options as suggested in the link.
$gcc –O2 -o sample sample.c -I$NE10_INC_PATH -l:$NE10_LIB_PATH/libNE10.a
where $NE10_INC_PATH and $NE10_LIB_PATH are directories of source code and build respectively
It is giving error as
/tmp/ccfaq3Py.o: In function `main':
Ne10_Test2.c:(.text+0x7a): undefined reference to `ne10_addc_float_c'
Ne10_Test2.c:(.text+0x90): undefined reference to `ne10_addc_float_neon'
Could the error be in giving the folder path for include directory and lib directory incorrect? What should be the correct format for the folder and lib directories? Please give an example.
I know it may be a pretty basic question for C programmers but I am a beginner in C who find it pretty difficult to understand even the setting of environment variables and execution of programs. To be frank I am feeling very dumb when asking this question. So please give your suggestions. Any helpful links to simple tutorials on including C or C++ libraries in C++ will also be extremely helpful

Related

Xcode (Version 9.2 (9C40b)): C++ Semantic and linker issues when trying to include boost

I am currently working on a masters project and I am desperately trying to compile some C++ code on my mac (macOS High Sierra 10.13.3 using Xcode) so I can develop the program at home. The Program is a set of files used for performing integrals on a bunch of different data... it uses headers from the boost library and also alglib. This all works fine on Windows machines running visual studios.
The issue I have is that when I include boost (which was installed via homebrew to usr/local/) into the search paths in the project build settings I get all sorts of semantic and linker issues.
I have searched this for a while and tried to implement a few potential fixes. I have tried:
Compiling with different C++ dialects and and standard libraries (libc++ and libstdc++).
Uninstalling/reinstalling boost.
Removing suggested header files and libraries from 'usr/local' suggested by brew doctor.
and implementing all sorts of other random permutations of settings that I felt could be issued.
The number of errors and warnings may change using different build settings however semantic issues persist and I am running out of ideas for how to proceed. It is really important I get this working and any insight would be appreciated.
From my reading about and attempting to troubleshoot I get the idea that it is some kind of linking issue between the boost library and the standard c++ libraries, but I have little experience with semantic issues as in the past I have been lucky enough that things just worked! Perhaps my MacBook may just have too much going on and needs some housecleaning to stop confusing the compiler, but regardless if anyone can help me fix this issue I would be eternally grateful!
I understand I haven't provided much detail here but if any information would be useful I'm happy to send screenshots.
link to errors image
In C++03 ifstream did not have a constructor that accepts std::string.
Such a constructor was added in C++11. The same holds for std::stod: it exists since C++11.
So you have to compile with -std=c++11 option.

I cannot compile this simple C++ program involving gd.h

This isn't my code, I am not a programmer but I did not expect simply compiling a provided source code would be so difficult.
Here it is, taken from Joel Yliluoma's page about "arbitrary-palette positional dithering algorithm", it was written in 2011.
This was my troubleshooting process, using MinGW:
The code didn't seem to make sense at all, so I realized it was written in an earlier version of C++, and added -std=c++98.
It couldn't find gd.h, I downloaded that from libgd's website, and directed to its directory using -I.
A bunch of gd related commands got a "undefined reference to" treatment. I tried to direct the compiler to gd.h/gd.c directory again using -l and followed by -lgd. And this is where I got stuck, as
The compiler insisted on not being able to find -lgd. I tried with different versions of libgd (especially older ones, before 2011) and sometimes it'd find what it's looking for, but then skip over them as they are incompatible.
I've also tried to compile it with another program called Dev-C++ but to no avail. Dev-C++ also gave back a "linker error". I can only assume that I messed up linking the header or library somehow, but I do not know what those terms mean frankly and just wanted a working program so I can get back to my imagery stuff. Maybe I downloaded the wrong gd.h, or I'm missing a required thing. Any help would be greatly appreciated.
Here's my current final MinGW input:
g++ -std=c++98 -Ipath\to\libgd code.cpp -Lpath\to\libgd -lgd -o executable.exe
I can assure you that path\to\libgd contains gd.h (and a bunch of other gd related stuff) and either one of these depending on which version of libgd I found: libgd.lib, libgd.dll.a, lidgb.def, libgd.rc, libgd.so.
I'm using Windows 7 64-bit.

Can't compile glew when using it via my own library : CodeLite

I have edited out a lot of my original situation to try keep things simple; it can be seen in the revisions.
Basically I have been following a tutorial in which a game engine is being created.
Most of the code has been separated into its own CodeLite project and successfully compiled into a static library (libbengine.a using mingw32 via TDM-GCC-32).
(For the record, the code compiled fine before separation)
Back in the main game code (main.cpp, etc) the compiler knows the relevant include and lib directories and compilation can at least locate the necessary headers and lib.
However, I get this error: undefined reference to '__glewCreateProgram'
Any ideas as to what is getting lost in translation (so-to-speak)?
I have been reading around all over the place; researching compilation, static libraries, ar.exe, but am having no luck (I am still looking).
If you want any more pertinent information, I will happily provide it; for now I shan't clog up the post any further.
Cheers
To give a basic idea of the error in CodeLite:
Main project linker settings:
bengine project linker settings (compiled as static lib.a):
It seems the problem was solely with linking order. As can be seen in the second image in my question (Main linker setting) - "Bengine" should have been at the top of the list, not the bottom.
This may be mingw32 specific; I am not sure.
Well, after all those hours, I feel somewhat foolish...
At least I have learned some things along the way.

Moving around the lblas library and using it with the g++ compiler

So on my current computer I Have a library to use BLAS functions, but I need to run my c++ program on an external server. I know how to transfer files to the server, but I'm having trouble figuring out how to find my blas library that's on my current computer and then how to link it to the compiler.
So here's the command I use current on my computer g++ program -lblas
And this works great. I run the program and everything is swell. How do I move this library to the external server?
Ideally, I'd like to move this library to the same folder as where my program resides and then link the compiler to that library somehow. Does anyone know how to do this?
If it helps, I know how to download a blas library and get a ".a" file out. I have no idea what to do from there though.
Never mind, simple question. I thought it was a lot more complicated.
For anyone that stumbles upon this, here's what you do:
Get your .a file. For me, I downloaded all the Makefile components necessary to make the .a file from here for blas: http://www.netlib.org/blas/
Next, put it in the same folder as your program if you want to do what I'm doing.
Finally, the command! Compiler, code, library
For me, this was g++ program.cpp blas.a

g++ linking issues: undefined reference to functions

I used CMake and Visual C++ to build the HyDE library. Then, still in VC++, I was able to successfully create code and build an executable that links into HyDE.lib and the HyDE header files.
I then discovered that in order to work with others at my company, it would be preferable to develop in Eclipse CDT. Knowing very little about Eclipse CDT, I created a default hello world project, deleted the code and then dumped in all of my code into the src folder. Then I attempted to change the includes and lib path and libs to mirror what had worked in VC++. At this point everything seems to compile, but I get an error in linking:
/cygdrive/c/EclipseWorkspace/425HyDE/Debug/../src/FS5HyDE.cpp:16: undefined reference to `HyDEAPI::HyDE::HyDE(HyDESystemModel::SystemModel*, bool)'
(There are many more errors like this, all referring to HyDE methods.) Here is what is being run at the command line:
g++ -L"C:\Progra~1\boost\boost_1_42\lib" -L"C:\EclipseWorkspace\HyDE" -o"425HyDE.exe" ./src/Adapter_FS5HyDE.o ./src/EPSCommands.o ./src/EPSCurrentSensor.o ./src/EPSFault.o ./src/FS5HyDE.o ./src/HyDEObservation.o ./src/MCDH.o ./src/MCDH_Module.o ./src/PDBComponent.o ./src/PowerSystem.o ./src/Program.o ./src/SSPCComponent.o ./src/Telemetry.o ./src/TelemetryReport.o -l:libboost_thread-vc90-mt-gd-1_42.lib -lHyDE
This is definitely not a library ordering problem because I've the other ordering as well (there are only two). Is it possible that there is a problem with compiling HyDE.lib in VC++ (which uses a Windows compiler) and compiling my program with g++? Could there be a problem in the way that Eclipse CDT is autogen'ing the makefiles? Any other ideas?
(Note: there appear to be plenty of others questions on SO with similar problems, but after reading through them I have yet to find one that addresses my problem.)
Classic missing symbol error. Which source file defines:
HyDEAPI::HyDE::HyDE(HyDESystemModel::SystemModel*, bool)' ?
Was this file added to the compilation? Can you spot it on the command line you pasted?
If this symbol belongs to an external library, after adding the directory path with -L , you could add the name of the specific library you want to link with your program using -l.
I'm going to suggest that you try to add to the compilation command the directory path to HyDE.lib, followed immediately by the library name, like this:
-L"C:\path_to_hyde_library" -l:HyDE.lib
and then tell us what happened.
Solution: Since the HyDE library was compiled with the Visual Studios compiler and I'm attempting to build the code that links to it with the Cygwin toolchain the two compilers use different name mangling schemes so that the latter linker can not find the expected symbols in the HyDE library. The only solution that I've found is to recompile the HyDE library with the Cygwin toolchain or compile the new code with whatever compiler Visual Studios is using. (grumble grumble)
./src/FS5HyDE.o and ./src/HyDEObservation.o should be the latest parameter if other object files (*.o files) need them, it means that the most needed object files should be appeared as last as possible in the parameters list.