what happened to SDL_mixer.h? - xcode

I am trying to get some open source C++ code to compile in xcode. It uses the SDL library. I downloaded SDL 2.0 for OS X and installed it and things are working -- but the download didn't seem to include the file SDL_mixer.h -- which is referenced in the code, as shown below.
#include <SDL/SDL_mixer.h>
What happened to this file? Did it get dropped from SDL? What do I do to work around the missing file to get the code working?

SDL Mixer has always been a separate library you have to install next to your SDL.
To fix your problem, download and install the library in such a way that SDL_mixer.h is located in an SDL/ folder of your include paths.

Install the SDL Mixer framework and add a reference to it in your project.
Include the SDL_Mixer.h header like so:
#include <SDL2_Mixer/SDL_Mixer.h>

Related

gtsam is not able to find Eigen

I use version 4.1.1 of GTSAM. I have version 3.3.4 of Eigen installed.
The error is:
/usr/local/include/gtsam/base/OptionalJacobian.h:22:10: fatal error: Eigen/Dense: No such file or directory
#include <Eigen/Dense>
I tried building GTSAM with the flag -DGTSAM_USE_SYSTEM_EIGEN set to both on and off.
The same error message appears in both cases.
For reference this is a ROS project built with catkin.
Have you seen this PR: https://github.com/borglab/gtsam/pull/1304
If you can upgrade GTSAM to 4.2a8, it uses Eigen's find script's rather than custom ones and should properly find Eigen3, if you have it installed if you require to build from source.
Since you are using ROS, why not go the standard route... Have you declared a dependency on it in your package.xml and installed it with rosdep?
https://github.com/ros/rosdistro/pull/23198/files
Add to your package.xml:
<depend>gtsam</depend>
And, your CMakeLists, you just call
find_package(gtsam REQUIRED)
It is unclear to me, if gtsam is available through binaries, why you would be building it from source.
I was able to get it working by cloning version 4.0.3 of GTSAM into the src folder of my workspace, then building it with the following arguments:
-DGTSAM_USE_SYSTEM_EIGEN=ON -DGTSAM_POSE3_EXPMAP=ON -DGTSAM_ROT3_EXPMAP=ON

How to get GLUI to work on macOS using Xcode?

I downloaded GLUI from https://github.com/libglui/glui, but I am not clear on how to get it to work on my Xcode. I read this step:
To include GLUI in your own apps, add the glui library to your makefile (before the glut library 'libglut.a'), and include "glui.h" in your sources.
Where would I find my makefile since I am using Xcode?
I was able to get #include to compile, but if I try GLUI *glui from the manual, I get "Unknown type name 'GLUI'". There is something on the front page: https://lukecyca.com/2008/glui-235-framework-for-mac-os-x.html where it mentions #include, but I don't know where I can get GLUI/glui.h.
After you build the lib, you'll have two directories lib and include which you have to move to your Xcode project. It'll look like this:
If Xcode does not see the includes nor links to the library, you'll have to add them to search paths (headers and libraries) like so:
NOTE: In order to use them in Obj-C you'll have to change file extension to .mm (obj-c++ file).

missing payoffs.hpp and other .hpp from version

When building the Windows C++ version of quantlib 1.9.1, I get this error of missing payoffs.hpp. When I browse to the directories, I see payoffs.cpp, but not payoffs.hpp:
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'ql/instruments/payoffs.hpp': No such file or directory FittedBondCurve c:\users\administrator\google drive\quantlib-1.9.1\ql\cashflows\conundrumpricer.hpp 27
I also get this for #include <ql/instruments/swap.hpp> [and possibly others]. I am able to build the windows quantlib library ok. Just not the examples.
I just checked the QuantLib 1.9.1 release available from the project downloads (did you get your version from there?) and the files you're looking for are contained in the release zip and tarball. Also, it's pretty weird that you could compile the library without them, so I'd double check if they're there. If they really aren't—well, hard to know how they got displaced; anyway, you can download the release again and replace them. If that doesn't fix the problem (or if they're already there after all), it's possible that you have to fix the include path for the example you're trying to compile. Does it include the QuantLib directory?

Library not found OpenCV

I'm on mac 10.7.5, using xcode 4.6.2 and working with the OpenCV 2.4.3 library. I went through the process of making the build directory with the cmake files in terminal and did the download.
I added the .dylib files in Xcode and changed the header path, changed C++ Library to libstdc++, but when I compiled I got this error :
ld: library not found for -lopencv_calib3d.2.4.3
clang: error: linker command failed with exit code 1
I have libopencv_calib3d.2.4.3.dylib added in the project so I have no idea what else it needs.Any ideas?
If your "make back-end" is Cmake you should stick to using it. Local config changes in Xcode can "secretly" be overwritten when the cmake is rerun (which for example happens after you make changes to it) creating weird build errors and forcing you to remember all the manual changes you made.
Your problem seems to be that the generated project doesn't seem to know where to look for opencv.
Assuming you installed opencv using macports you should add a line saying
link_directories(/opt/local/lib)
to your CMakeLists.txt. (if you installed it using brew, or compiled it manually just replace /opt/local/lib for /usr/local/lib or the path to your compiled libraries)
Also make sure to link against opencv_calib3d instead of opencv_calib3d.2.4.3 (unless you have a very particular reason for bypassing this, but that usually means that something else is weird in the setup :) )
Final pointer that you might already know of: As you are already using Cmake you should add the libraries to link against using TARGET_LINK_LIBRARIES(...) in Cmake rather than manually adding them in Xcode (referring to my previous argument).

Adding Bonjour (dns_sd.h) library to Qt in Windows

I've been trying to properly add the open source dns_sd.h library provided by Apple. I am writing a program that uses the BonjourRegistrar class as demonstrated here:
link text
I've already written my program on the Mac environment and now I am trying to port it to Windows. The Bonjour SDK comes with several classes, and I am quite confused onto how to correctly add the class to my Qt project. I have tried add the line:
win32:LIBS += c:\dnsssd.lib
in the .pro file with no success. Also, I attempted to add the dns_sd.h and dns_sd.c files into my project and got a couple of errors such as:
'UINT8': does not name a type
'INT8': does not name a type
'UINT16' does not name a type
'INT16' does not name a type
Finally, I am now trying to modify the lib file as described by xcimo in this link
link text
I do not know if I am using the correct command to properly modify these files.
The .lib distributed by Apple can be used only if you are compiling the Qt application with the MSVC compiler.
Otherwise, like you said, you need a GCC-compatible library (.a). To do that you need to do the following steps:
Run the reimp tool [0] on the .lib: reimp dnssd.lib. A file DLLStub.obj will be generated.
Run the gendef tool [1] on the .dll: gendef dnssd.dll. A file dnssd.def will be generated. The .dll can be obtained from: C:\Windows\System32 if you are using the 32 bit or from C:\Windows\SysWOW64 for the 64 bit version.
Assemble the final .a: dlltool -k -d dnssd.def -l libdnssd.a.
Add the right path int the .pro file, to the newly created library: LIBS += -L"/path/to/the/library/file" -ldnssd
[0] - http://sourceforge.net/projects/mingw/files/MinGW/Extension/mingw-utils/mingw-utils-0.4-1/
[1] - http://sourceforge.net/projects/mingw/files/MinGW/Extension/gendef/gendef-1.0.1346/ - gendef is a better alternative to pexports, because it can convert the stdcall-type libraries from MSVC to the GCC ones, so you can get a proper .def file.
PS: I know the author got it working, but I felt there should be some more detailed instructions on how to get it done -- the information is scattered around the internet.
Try adding
DEFINES += _WIN32
to your project file.
I figured it out, you need to use reimp and dll tool to modify the lib library to a .a

Resources