Is it possible to compile iPhone app via command-line gcc? - ios

If i want to compile minimum OSX app via command-line gcc i can compile the file test.m:
#import <AppKit/AppKit.h>
int main( int argc, char** argv ) { return 0; }
via following command:
gcc -c test.m
But how to compile iOS app same way? I change test.m to refer iOS cocoa touch:
#import <UIKit/UIKit.h>
int main( int argc, char** argv ) { return 0; }
And this is no longer compiles with error:
test.m:1:24: error: UIKit/UIKit.h: No such file or directory

You probably want to use xcodebuild if you're building apps from the command line, as they consist of more than just Objective-C files.

Related

'iterator' file not found when compiling bar for iOS

I was using Xcode 11 to compile zbar for my iOS Device.
However it gives me this error:'iterator' file not found
Some code:
#ifndef _ZBAR_IMAGE_H_
#define _ZBAR_IMAGE_H_
/// #file
/// Image C++ wrapper
#ifndef _ZBAR_H_
# error "include zbar.h in your application, **not** zbar/Image.h"
#endif
#include <assert.h>
#include <iterator>
#include "Symbol.h"
#include "Exception.h"
I have tried to clean and rebuild and this didn't seem to work.
Environment:
Mac OS Catalina 10.15 Beta (19A558d)
Xcode 11.0(11A420a)
C11
<iterator> is a c++ reference, please refer to here.
so,
a. Renaming the image.c to image.cpp
or
b. Compile with g++, NOT gcc
would be helpful.

In ROS how to publish my own topic?

I am a beginner in ROS.My operation system is Ubuntu 12.04 and my ROS is hydro.After I read some chapters about the "talker and listener" of The Beginner Tutorials in ROS.wiki,I try to write a publisher to publish message to topic "turtle1/com_vel" so that I can control the turtle to run round.But when I try to make my code,it fails.The terminal remind me that
CMake Error at /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:72 (find_package):
Could not find a configuration file for package ros.
Set ros_DIR to the directory containing a CMake configuration file for ros.
The file will have one of the following names:
rosConfig.cmake
ros-config.cmake
I guess that there is something wrong with my CMakeLists.txt.But after comparing it with the demo in ROS.wiki,I still can't find the error.
This is my code in cpp file.In this file,I define a publisher named move_turtle.
#include "ros/ros.h"
#include "geometry_msgs/Twist.h"
int main( int argc, char** argv )
{
// initialization
ros::init(argc, argv, "move_turtle");
ros::NodeHandle n;
ros::Publisher move_pub = n.advertise<geometry_msgs::Twist>("turtle1/com_vel",100);
ros::Rate loop_rate(10);
//define the moving rule that I want.It is a circle.
geometry_msgs::Twist com_cicle;
com_cicle.linear.x=3.0;
com_cicle.linear.y=com_cicle.linear.z=0.0;
com_cicle.angular.x=com_cicle.angular.y=0.0;
com_cicle.angular.z=2.0;
while(ros::ok())
{
//publish the msg to topic /tuttle1/com_vel
move_pub.pulish(com_cicle);
ros::spinOnce();
loop_rate.sleep();
}
return 0;
}
And my CMakeLists.txt is as follows:
cmake_minimum_required(VERSION 2.8.3)
project(move_turtle)
find_package(catkin REQUIRED COMPONENTS
ros
geometry_msgs
turtlesim
)
catkin_package()
include_directories(
${catkin_INCLUDE_DIRS}
)
## Declare a cpp executable
add_executable(move_turtle src/move_turtle.cpp)
## Specify libraries to link a library or executable target against
target_link_libraries(move_turtle ${catkin_LIBRARIES})
Oh...I used 'ros' instead of 'roscpp' in line 5 in 'CMakeLists.txt'.That was why it reminded me that there was no 'ros' package in my path.

ImageMagick No such file or directory

I am trying to get a screen shot using the following code;
#include <stdio.h>
#include </wand/MagickWand.h>
int main(int argc, char **argv)
{
MagickWandGenesis();
MagickWand *wand = NULL;
wand = NewMagickWand();
MagickReadImage(wand,"x:root"); // <-- Invoke ImportImageCommand
MagickWriteImage(wand,"screen_shot.png");
if(wand)wand = DestroyMagickWand(wand);
MagickWandTerminus();
return 0;
}
however I am getting the following error message, magick-config.h is in the specified folder 'magick/magick-config.h' , I do not understand what the problem is;
$ make screenshot
cc screenshot.c -o screenshot
In file included from /wand/MagickWand.h:29:0,
from screenshot.c:2:
/magick/magick-config.h:29:3: warning: #warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
/magick/magick-config.h:30:3: warning: #warning "this is an obsolete behavior please fix your makefile"
/magick/magick-config.h:52:3: warning: #warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
/magick/magick-config.h:53:3: warning: #warning "this is an obsolete behavior please fix yours makefile"
In file included from /wand/MagickWand.h:70:0,
from screenshot.c:2:
/magick/MagickCore.h:29:36: fatal error: magick/magick-config.h: No such file or directory
compilation terminated.
<builtin>: recipe for target `screenshot' failed
make: *** [screenshot] Error 1
Any help would be much appreciated.
Thanks
Yes, Actually I had a problem like that and it was fixed when I installed the package libmagickcore-dev with following command:
sudo apt-get install libmagickcore-dev
through the Ubuntu Repositories. :-)
Also If it did not work, you try installing the package called "graphicsmagick-libmagick-dev-compat".
AC;
You might have installed too much?
Try to remove Image-magick-"Perl Module"
The Perl Module.
And then again try the process to install ImageMagick with PECL or your other way.
Often this problem is occurring because of installation made with make install on a platform.
Remove all other installations and just do the installation from pure sources if you already started doing that.
.deb and .rpm packages might be installed in different ways than making from source.

issues with create an opencv window

I have Mac OS Lion 10.7.5 and xCode 4.6. I've downloaded an opencv template. Then retrive a framework and want to create my own project. For the first i install cmake 2.8.10, add a framework and that's it. In main.m i try to create a window:
#import <UIKit/UIKit.h>
#include "opencv2/highgui/highgui_c.h"
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
IplImage* img = cvLoadImage("1.png", 8);
cvNamedWindow("Example",CV_WINDOW_AUTOSIZE); //Thread 1: signal SIGANRT
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
And in debug area i got following:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /Volumes/minijHome/Documents/xcode_mini/hillegass/advancedIOS/postCourse/openCV/clean-downloads/openCVgitClone/opencv/modules/highgui/src/window.cpp, line 652
libc++abi.dylib: terminate called throwing an exception
What i have to do?

How to build GNUstep programs on OpenBSD?

I am trying to build a GNUStep program on OpenBSD. I installed packages gnustep-base and gnustep-make.
my main.m:
#import <Foundation/Foundation.h>
int main(void)
{
NSLog(#"Hello World!");
return 0;
}
GNUmakefile:
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = main
main_OBJC_FILES = main.m
include $(GNUSTEP_MAKEFILES)/tool.make
Then, I initialize the GNUstep environment using
. /usr/local/share/GNUstep/Makefiles/GNUstep.sh
And then I run:
make
This does not recognize the GNUmakefile.
Does anybody know how I can build a GNUstep program on OpenBSD?
On my Arch Linux installation, similar procedure works fine.
Try make -f GNUmakefile. If this command fails, install gmake and try gmake -f GNUmakefile.

Resources