I am trying to wrap already written C++ codes into Objective-C using "swig".
This is the solution approach that i am trying to follow : link
Basically i am using modified version of the swig in order to wrap into Objective-C. However during the installation steps i get the error message bellow;
clang: warning: argument unused during compilation: '-ansi'
Undefined symbols for architecture x86_64: "_swig_objectivec", referenced from:
modules in swigmain.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [eswig] Error 1
make[1]: *** [all] Error 2
make: *** [source] Error 2
What i notice after investigating the error message, 'Modules/obj.o' file has not been created while compiling swig.
Then i modified my "Makefile.in" added necessary lines for obj.cxx, now swig creates 'Modules/obj.o' files however this time i get the error message bellow;
make[2]: *** No rule to make target `Modules/obj.cxx', needed by
`Modules/obj.o'. Stop.
make[1]: *** [all] Error 2
make: *** [source] Error 2
Any help will be appreciated.
EDIT
In order to get the error messages listed above i made some file changes in the given project link. So maybe the first steps that i followed were wrong, so this is the error message that i get at very beginning (btw i kept getting the given error message even if i configured both 'automake' and 'autoconf');
configure.ac:15: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:33: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:35: error: possibly undefined macro: AC_COMPILE_WARNINGS
configure.ac:48: error: possibly undefined macro: AC_DEFINE
configure.ac:86: error: possibly undefined macro: AC_MSG_FAILURE
configure.ac:3041: error: possibly undefined macro: AC_DEFINE_DIR
Sorry I can't comment yet so I'll put it here. By wrap, do you mean that you want to compile and use c++ frameworks/code in your objective-c app? If so, I have found the easiest and most reliable way is to just app the files/frameworks and set the project compiler to see the language as objective-c++. Does this make sense? If I miss understood the question, please let me know :)
Related
I'm running a Makefile given to me to compile some Fortran code along with some C++ code. This is being compiled on CentOS using the intel compiler.I didn't write any of the code or the Makefile, also I have no clue what I'm doing.
When I run the Makefile script I get the following error when trying to do something with Fortran code 'libStuff':
ld: /home/myProject/trunk/libStuff/lib/libStuff.a(stuff.o): undefined reference to symbol 'for_inquire'
/opt/intel2019/compilers_and_libraries_2019.0.117/linux/compiler/lib/intel64_lin/libifcore.so.5: error adding symbols: DSO missing from command line
make[1]: *** [myProject] Error 1
I've played around with the Makefile and I've figured out that I need to add a flag to a specific line
MYFORTRANCODE=-L$(MYFORTRANCODE_LIB) -lSTUFF -lmpi_usempif08 -lmpi_mpifh -l_I_NEED_TO_ADD_SOMETHING_HERE
The problem is I don't know which flag to add, and couldn't find any helpful documentation on the intel website. Also I couldn't figure out what the 'for_inquire' thing means.
Anybody got any ideas?
the flag I needed to add was -lifcore. I figured it out.
I am trying to change the opencv svm predict function by passing an extra variable called std::pair & ,so that I can get the class label as well as decision function value from that function. I have change the source code in /home/rakib/opencv-2.4.9/modules/ml/src/svm.cpp and also add the function declaration in header file. The problem is that when I rebuild opencv I got the following error.
Scanning dependencies of target opencv_python
[ 75%] Building CXX object modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o
In file included from /home/rakib/opencv-2.4.9/modules/python/src2/cv2.cpp:1129:0:
/home/rakib/opencv-2.4.9/build/modules/python/pyopencv_generated_types.h: In function ‘PyObject* pyopencv_CvSVM_predict(PyObject*, PyObject*, PyObject*)’:
/home/rakib/opencv-2.4.9/build/modules/python/pyopencv_generated_types.h:4878:5: error: ‘pair_double_and_double’ was not declared in this scope
pair_double_and_double labConCount;
^
/home/rakib/opencv-2.4.9/build/modules/python/pyopencv_generated_types.h:4878:28: error: expected ‘;’ before ‘labConCount’
pair_double_and_double labConCount;
^
/home/rakib/opencv-2.4.9/build/modules/python/pyopencv_generated_types.h:4885:40: error: ‘labConCount’ was not declared in this scope
pyopencv_to(pyobj_labConCount, labConCount, ArgInfo("labConCount", 0)) &&
^
make[2]: *** [modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
make: *** [all] Error 2
Though I want to change the c++ code of opencv but it some how related to python opencv interface so far I understood.
So any help to fix this problem is greatly appreciated.
If you change the source and would like to see the change in python as well, you'll also need to regenerate the python bindings.
See here for more details.
The problem is solved by using cmake -D BUILD_NEW_PYTHON_SUPPORT=OFF
I've tried to compile this custom QT widget to provide a terminal that I can embed into my application. I've compiled/installed the build tools for the program that I needed before Cmake would complete, but the make step is throwing errors that google hasn't been too helpful on:
[ 50%] Building CXX object CMakeFiles/qtermwidget5.dir/lib/kpty.cpp.o
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:506:26: error: no member named 'ut_name' in 'utmpx'
strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
~~~~~~~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:506:57: error: no member named 'ut_name' in 'utmpx'
strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
~~~~~~~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:617:20: error: no member named 'ut_name' in 'utmpx'
memset(ut->ut_name, 0, sizeof(*ut->ut_name));
~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:617:44: error: no member named 'ut_name' in 'utmpx'
memset(ut->ut_name, 0, sizeof(*ut->ut_name));
~~ ^
4 errors generated.
make[2]: *** [CMakeFiles/qtermwidget5.dir/lib/kpty.cpp.o] Error 1
make[1]: *** [CMakeFiles/qtermwidget5.dir/all] Error 2
make: *** [all] Error 2
Does anyone have a solution to this problem?
And as an extension, how exactly does one effectively include a custom widget as to be usable in QT Creator?
http://pubs.opengroup.org/onlinepubs/7908799/xsh/utmpx.h.html
It looks like it doesn't include ut_name in the stock version of utmpx.h.
If you look at this version of it:
https://code.woboq.org/kde/include/bits/utmp.h.html
They have a "backwards compatibility hack" in there:
87 /* Backwards compatibility hacks. */
88 #define ut_name ut_user
You may want to upgrade that library that includes that header. Or just insert that #define in your code. And as a good github citizen, if it works, you should do a pull request and/or submit an issue about it so that the next person using that library doesn't run into the same issue.
Hope that helps.
I don't know why the problem happened, since according to all the files I checked everything was named properly.
Adding #define ut_user ut_name to kpty.h solved the problem though.
I've tried to compile this custom QT widget to provide a terminal that I can embed into my application. I've compiled/installed the build tools for the program that I needed before Cmake would complete, but the make step is throwing errors that google hasn't been too helpful on:
[ 50%] Building CXX object CMakeFiles/qtermwidget5.dir/lib/kpty.cpp.o
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:506:26: error: no member named 'ut_name' in 'utmpx'
strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
~~~~~~~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:506:57: error: no member named 'ut_name' in 'utmpx'
strncpy(l_struct.ut_name, user, sizeof(l_struct.ut_name));
~~~~~~~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:617:20: error: no member named 'ut_name' in 'utmpx'
memset(ut->ut_name, 0, sizeof(*ut->ut_name));
~~ ^
/Users/a7c/qtermwidget/qtermwidget-master/lib/kpty.cpp:617:44: error: no member named 'ut_name' in 'utmpx'
memset(ut->ut_name, 0, sizeof(*ut->ut_name));
~~ ^
4 errors generated.
make[2]: *** [CMakeFiles/qtermwidget5.dir/lib/kpty.cpp.o] Error 1
make[1]: *** [CMakeFiles/qtermwidget5.dir/all] Error 2
make: *** [all] Error 2
Does anyone have a solution to this problem?
And as an extension, how exactly does one effectively include a custom widget as to be usable in QT Creator?
http://pubs.opengroup.org/onlinepubs/7908799/xsh/utmpx.h.html
It looks like it doesn't include ut_name in the stock version of utmpx.h.
If you look at this version of it:
https://code.woboq.org/kde/include/bits/utmp.h.html
They have a "backwards compatibility hack" in there:
87 /* Backwards compatibility hacks. */
88 #define ut_name ut_user
You may want to upgrade that library that includes that header. Or just insert that #define in your code. And as a good github citizen, if it works, you should do a pull request and/or submit an issue about it so that the next person using that library doesn't run into the same issue.
Hope that helps.
I don't know why the problem happened, since according to all the files I checked everything was named properly.
Adding #define ut_user ut_name to kpty.h solved the problem though.
I'm trying to compile libgtextutils (required by the fastxtoolkit) from source. The './configure' command runs nicely, however subsequent 'make' command produces an error that I cannot resolve.
text_line_reader.cpp: In member function ‘bool TextLineReader::next_line()’:
text_line_reader.cpp:47:9: error: cannot convert ‘std::istream {aka std::basic_istream<char>}’ to ‘bool’ in return
return input_stream ;
^~~~~~~~~~~~
make[3]: *** [text_line_reader.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
I'm on a Mac, OSX 10.11.6 (Intel)
Any suggestions that might solve this are highly appreciated.
See the Porting to GCC 6 guide, which documents this as one of the changes you must deal with due to GCC 6 defaulting to C++14 mode instead of C++03 mode:
Cannot convert 'std::ostream' to 'bool'
As of C++11, iostream classes are no longer implicitly convertible to void* so it is no longer valid to do something like:
bool valid(std::ostream& os) { return os; }
Such code must be changed to convert the iostream object to bool explicitly, e.g. return (bool)os; or return static_cast<bool>(os);
Another option is to explicitly use -std=c++03 in your compiler flags to compile in C++03 mode, but it's better to fix the code. The fixes given above will make the code compatible with any C++ version.
This is because of using a newer version of gcc compiler (C++11).
Use static_cast<bool>() to resolve the issue.
example: change
success = move_group.move();
to
success = static_cast<bool>(move_group.move());
Based on the answers of both Muthanna and Jonathan, for anyone with absolutely no knowledge of C++ but wanting to install fastx-toolkit on *unix and coming across these challenging responses, the answer is to run this after unpacking the source code:
cd libgtextutils-0.7
sed -i '47s/input_stream/static_cast<bool>(input_stream)/' src/gtextutils/text_line_reader.cpp
./configure
make
make install
This makes the change that the other, clearly far more knowledgeable, respondents suggest making, without having to understand a word that they're talking about. This should make it work for those of us who are just trying to get some old software to install and aren't looking to learn how to write C++ (just yet...)
Another option is to override the C++ flags in the make command:
make CXXFLAGS='-std=c++03 -O1'
As noted above, fastx will also have a compilation error but it will compile if you pass it
make CXXFLAGS=-O1.