How are the libraries .h files included - dagger-2

I have successfully generated Objc .m and .h files from my simplistic Dagger-2 code.
https://gist.github.com/OscarRyz/ffd976fcae9acf87dbe1
Now I'm trying to compile those file using j2objcc but the error message says it can't find .h for the the Dagger-2 classes:
j2objcc -c -I. `find app -name *.m`
In file included from app/DaggerSearchComponent.m:10:
./app/SearchInPage_Factory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
app/SearchComponent.m:11:10: fatal error: 'dagger/Component.h' file not found
#include "dagger/Component.h"
^
1 error generated.
In file included from app/SearchInPage_Factory.m:8:
./app/SearchInPage_Factory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
In file included from app/SearchInPage_MembersInjector.m:9:
./app/SearchInPage_MembersInjector.h:10:10: fatal error: 'dagger/MembersInjector.h' file not found
#include "dagger/MembersInjector.h"
^
1 error generated.
app/SearchModule.m:10:10: fatal error: 'dagger/Module.h' file not found
#include "dagger/Module.h"
^
1 error generated.
In file included from app/SearchModule_ProvideHostFactory.m:8:
./app/SearchModule_ProvideHostFactory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
In file included from app/SearchModule_ProvideHttpClientFactory.m:9:
./app/SearchModule_ProvideHttpClientFactory.h:10:10: fatal error: 'dagger/internal/Factory.h' file not found
#include "dagger/internal/Factory.h"
^
1 error generated.
Question: Does this means that I need to have the library source code while generating the ObjC code so the .h for those could be generated as well?

Original answer from #tabll
Dagger isn't distributed with j2objc, so you have to build it yourself. To do so (requires Maven, described in the Building J2ObjC wiki):
git clone https://github.com/google/dagger.git
cd dagger
mvn install
j2objc -d build -classpath $J2OBJC_HOME/lib/javax-inject.jar -sourcepath core/src/main/java `find core/src/main/java -name *.java`
cd build
j2objcc -c -I. `find dagger -name *.m`
ar -r libdagger.a *.o
Notes:
Specify J2OBJC_HOME either where your j2objc distribution was unzipped, or if you built j2objc, its dist directory. To test, "ls $J2OBJC_HOME/j2objc" should list the j2objc script.
These instructions generate the macosx architecture, useful when testing. The files need to be recompiled for each architecture you want to use -- the easiest way to do so is to create a static library project in Xcode, add the translated files, then include this project in your app and add it as a dependency of your app.
ar will warn that "libdagger.a(package-info.o) has no symbols", which can be ignored since it doesn't have any symbols.

Related

Can not build a mex file in octave using mkoctfile --mex

I am trying to build a mex file in octave. The Octave instructions says that we need to use mkoctfile --mex to build one. The file I am trying to build is in the following path:
> C:\devwork\Octave\boosted\toolbox\channels\private\rgbConvert.cpp
When I write
> mkoctfile --mex rgbConvert.cpp
I get the following error:
> g++: error: rgbConvert.cpp: No such file or directory g++: fatal
> error: no input files compilation terminated.
Note: My current directory is set correct. It is at \devwork\Octave\boosted\toolbox\channels\private
Can some one explain me why am I getting this error.
The problem is resolved using: mkoctfile --mex -DMATLAB_MEX_FILE rgbConvertMex.cpp
Hence, if you want to convert any Matlab compiled .mex file to Octave executable file, do the following two steps:
Modify wrappers.hpp file by adding #include <stdlib.h>
Save the file.
Simply run: mkoctfile --mex -DMATLAB_MEX_FILE file_name
.o file will be created.
I did it using the same and it worked fine.
Eskapp was grateful enough to release the Octave compiled MEX files. You'll need to manually add the files to the main toolbox.Please find the link here:
https://github.com/Eskapp/Piotr_vision_extrafiles_Octave
Hope it helps others :)

Eclipse Path to Include Directories not working for me (Windows 7-64, C++)

I installed GCC (4.8.1) this morning and Eclipse Kepler (SR2). My Hello World compiled and ran fine, so I'm moving toward my goal of writing a C++ app using Boost. I installed Boost to "C:\Program Files\boost\boost_1_55_0" and added this path to Project>Properties>C/C++ General>Paths and Symols>[tab]Includes>GNU C++. However, when I compile, the path isn't showing up in the g++ command line, so understandably, the header file isn't getting found.
15:55:24 **** Incremental Build of configuration Debug for project BoostApp ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\BoostApp.o" "..\\src\\BoostApp.cpp"
..\src\BoostApp.cpp:1:32: fatal error: boost/filesystem.hpp: No such file or directory
#include "boost/filesystem.hpp"
^
compilation terminated.
15:55:24 Build Finished (took 78ms)
I realize this is a newb question and spent a few hours searching around and finding mostly direction to set the path, which I've done. I've checked the install and the header file is there. I've also done my own command line compile adding "-I C:\Program Files\boost\boost_1_55_0" to the command line and GCC found the header file fine.
Not sure where I'm going wrong. As mentioned, it's a new install of GCC, Eclipse, and Boost, so maybe I went wrong somewhere during the install or maybe creating the project? Or just a newb question? Below is the app I'm compiling which I copied from rosettacode.com
#include "boost/filesystem.hpp"
#include "boost/regex.hpp"
#include <iostream>
using namespace boost::filesystem;
int main()
{
path current_dir("."); //
boost::regex pattern("a.*"); // list all files starting with a
for (recursive_directory_iterator iter(current_dir), end;
iter != end;
++iter)
{
std::string name = iter->path().filename().string();
if (regex_match(name, pattern))
std::cout << iter->path() << "\n";
}
}

CLAPACK not linking

I have downloaded CLAPACK and built it according to these instructions:
http://www.netlib.org/clapack/readme.install
Everything was OK and I had no errors. I then put my three headers blaswrap.h clapack.h and f2c.h into the /usr/local/include folder.
I put the libraries blas_LINUX.a, lapack_LINUX.a and tmglib_LINUX.a into the folder /usr/local/lib64
I then try and link in my C file
#include "blaswrap.h"
#include "f2c.h"
#include "clapack.h"
When Linking I do this
-g -O3 -lm -L/usr/local/lib64
I have tried to link to the actual library like
-lcblas -llapack
And many other ways but still no luck. Any ideas what I could try?
And I get the error
fatal error: blaswrap.h: No such file or directory

fatal error: QScriptEngine: No such file or directory

I am working on blackberry project when i include
#include <QScriptEngine>
in my .cpp file it gives be error
fatal error: QScriptEngine: No such file or directory
can any one tell what should i include in .pro file so that i can get rid of this error .
Try replacing it with
#include <QtScript/QScriptEngine>
The qt4 include dir should be on your include path by default as long as you have CONFIG += qt somewhere in your pro file. So my guess is you just need to qualify where QScriptEngine is beneath the qt4 dir (which is inside QtScript dir).

eclipse cdt not seeing header files in project packages?

I am trying to compile a project but I'm getting an error right away that it's not seeing the header files that are in some packages inside the project. Here is a picture, notice that it is not finding the AwarenessMoment.h file, however it is in there.
Here is the output:
**** Build of configuration Debug for project RoyOS ****
make all
Building file: ../src/royos/vision/ImageRecognizer.cpp
Invoking: GCC C++ Compiler
g++ -I/home/igvc/Documents/teamigvc/trunk/RoyOS -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/royos/vision/ImageRecognizer.d" -MT"src/royos/vision/ImageRecognizer.d" -o"src/royos/vision/ImageRecognizer.o" "../src/royos/vision/ImageRecognizer.cpp"
In file included from ../src/royos/vision/ImageRecognizer.cpp:8:0:
../src/royos/vision/ImageRecognizer.h:11:29: fatal error: AwarenessMoment.h: No such file or directory
compilation terminated.
make: *** [src/royos/vision/ImageRecognizer.o] Error 1
Anyone know why it's not seeing these header files?
Thanks
There's definitely something wrong with the include path given to the compiler. The preprocessor can't find the header from the source file you are attempting to compile.
I think you could fix this by replacing
#include "AwarenessMoment.h"
with
#include "../sensor/AwarenessMoment.h"
Either that or alter the compiler include path to include the sensor directory and use:
#include <AwarenessMoment>