Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Friday, October 19, 2012

XCode 4.5.1 linking error with Opencv 2.4.2_1

I always keep my software updated to the latest version. Generally, it works perfectly fine. However, after I upgrade Xcode into 4.5.1 and Opencv to 2.4.2_1 though macports. The simple opencv 2.0 style compile will keep pushing out linking errors.

The solution is the attached image below, switch the selected item from libc++ (LLVM) into libstdc++(GNU C++ standard library)

Hope this is helpful.


Monday, September 24, 2012

mexopencv compile error in MacOSX 10.8

I had the following error message, at the end of this post, when I installed the mexopencv on my MacOSX 10.8 with Xcode 4.5, opencv installed from macports, and config_pkg properly installed.

First of all, I grab the patch from the following link to connect Matlab mex with Xcode,

https://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/

Second, I modify the MACOSX_DEPLOYMENT_TARGET=10.5 into 10.6 or higher.

After these steps, you should be able to compile and enjoy the mexopencv. 

PS: website of mexopencv, (many thanks to kota)
http://www.cs.sunysb.edu/~kyamagu/mexopencv/

/Applications/MATLAB_R2012a.app/bin/mex -c -cxx -largeArrayDims -Iinclude -I/opt/local/include/opencv -I/opt/local/include   src/MxArray.cpp -outdir lib
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available

   mex: compile of ' "src/MxArray.cpp"' failed.

make: *** [lib/libMxArray.a] Error 1

std::cout undefined issue in MacOSX

In Mac, sometimes, especially in terminal with Makefile, you would meet the error message, such as

"error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available",

even with a simple code as following:

#include <iostream>
int main(){
    std::cout << "hello world" << std::endl;
    return 0;
}

The main reason might be, the compiled being used is gcc instead of g++, in g++, not like gcc, the         -lstdc++ will be automatically added. This will link the STL library with your compiler.

Saturday, September 15, 2012

How to compile 3d party mex file in MacOSX 8 (mount lion)

Once you downloaded some .cpp files from 3rd party group, the urgency of testing on new code makes you attempt to compile them asap. However, you may meet the following error message:


/Applications/MATLAB_R2012a.app/bin/mex: line 305: gcc-4.2: command not found
/Applications/MATLAB_R2012a.app/bin/mex: line 1326: g++-4.2: command not found

This is because your matlab haven't been able to co-work with XCode installed on your machine. 

I founding the following solutions from Mathworks.com, it should be official and, it does work, at least on my machine. 

Cheers, and wish you guys good luck. :) 


http://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/

Saturday, September 8, 2012

How to create bootable Windows 7 disk on Mac OSX


1. Double click the .iso file to mount the disk
2. One the menu bar at the top, click "Images" -> "Convert"
3. Make sure the "Image Format:" is set to "DVD/CD master"
4. Save the IMage where you want to locate, it will prompt to ask to save as ".cdr" file
5. Navigate to the Image you just created and change the extension from ".cdr" to ".iso"
6. Burn it using Disk Utility and this CD should be bootable.


This information is learnt from the following link:

http://kyliente.wordpress.com/2010/04/02/making-windows-bootable-cddvd-with-mac-disk-utility/

Monday, September 3, 2012

org-mac-link-grabber with Aquamacs

Org mode is a powerful plus for emacs, if you want to organize you daily life to be more productive.

When you note you everyday work, especially communicating with co-workers, such as you advisor, boss, students. You may want to add a reference to you work todo list, note or working log, such an email, url or even a contact. This is where org-mac-link-grabber shining.

You could install this mode easily follow the link below:

http://orgmode.org/worg/org-contrib/org-mac-link-grabber.html

However, unfortunately, this is not enough, after you follow the link above, you will find emacs can not find function omlg-grab-link,this is because you haven't let the emacs link where org-mac-link-grabber.el is.

You may need to follow the link below:

http://irreal.org/blog/?p=732

Especially this two lines:


(add-to-list 'load-path (expand-file-name "~/.xemacs/org-mode/contrib/lisp")) ; where your org-mac-link-grabber.el lives
(require 'org-mac-link-grabber)

After all this, enjoy! You will be more productive tmw, hopefully. :)


Sunday, September 2, 2012

Installing Qt on Mac MountLion

Don't install qt though Macports till now "2 Sep 2012" It just doesn't work yet.

Install the QtSDK, which includes Qt Creator, save you some trouble.

After Installation, when you run an application, you may incur an error in the following link,

http://qt-project.org/forums/viewthread/19106/P15

Follow the instruction.

If you don't know where the g++-macx.conf is, just search this file name within "This Mac"
(in my system it lies in: QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/common/g++-macx.conf)

If you still have problems, pls make sure you are using Qt Version: Desktop Qt 4.8.1 for GCC (Qt SDK) in  QT projects setting.


prettify