compiler errors using Boost.Python with macports Python.framework - boost-python

This might be a very dumb question...
I'm trying to use Boost.Python in an Xcode project (boost 1.50, xcode 4.4, OS X 10.8). I installed both boost and python through macports. I dragged the macports Python framework (/opt/local/Library/Frameworks/Python.framework) into the project and tried the most minimal program possible:
#include <boost/python.hpp>
int main(int argc, const char * argv[]) {
Py_Initialize();
Py_Finalize();
return 0;
}
and get:
/opt/local/include/boost/python/detail/wrap_python.hpp:50:11: fatal error: 'pyconfig.h' file not found
Do I need to explicitly add the framework header folder to the project's header search paths? That seems irregular... so hopefully I'm just misunderstanding something?

Related

Windows: Eclipse & googletest

I am trying to setup googletest in Eclipse. I really got stuck.
I downloaded the current googletest version 1.13.0. fuse_gtest_files.py is not included in this version (which is often referred to in instructions).
Anyway, I set up an empty c++ project (GCC C++ compiler). Then I added the include paths for the gtest header files (compare picture).
enter image description here
Afterwards, I tried to compile the code. I got the error message "undefined reference to `testing::InitGoogleTest(int*, char**)'" - Reason: It could not find the related .cc files.
#include "gtest/gtest.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
So I added the source Location of the cc files (compare Screenshot).
enter image description here
Now, the function is found. But I get a bunch of errors "multiple definition of xx"
C:/xxx/tools/googletest-1.13.0/googletest/src/gtest-assertion-result.cc:45: multiple definition of testing::AssertionResult::AssertionResult(testing::AssertionResult const&)'
src\gtest-all.o:C:/xxx/tools/googletest-1.13.0/googletest/src/gtest-assertion-result.cc:45: first defined here.`
Does anyone has an idea?
Thanks
Jenny

Eclipse CDT, CMake and GLIB

I have a simple c file:
#include <glib.h>
int main(int argc, char *argv[])
{
guchar temp = 1;
GSList *list = NULL;
list = g_slist_append(list, (int []){1});
}
and a simple CMakeLists.txt file:
PROJECT (GLIB_TEST)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_C_COMPILER "/usr/bin/c99")
find_package(PkgConfig)
pkg_check_modules(GLIB REQUIRED glib-2.0)
include_directories(${GLIB_INCLUDE_DIRS})
add_executable(glibtest glibtest.c)
target_link_libraries(glibtest ${GLIB_LIBRARIES})
I use
$ cmake -G'Eclipse CDT4 - Unix Makefiles' -D CMAKE_BUILD_TYPE=Debug ../src
from a "sibling" build directory. I then import the project into eclipse.
All seems well except that certain definitions do not resolve. Specifically in this case, neither "guchar" or "GSList" get resolved even though glib.h is definitely included via "/usr/include/glib-2.0" in the projects "C/C++ Include paths and symbols (I have verified this).
The specific error is "Type 'guchar' could not be resolved" and "Type 'GSList' could not be resolved".
From the command line "make" succeeds without error. Any ideas?

Opencv2.4.0 with mingw in windows get crashed

I followed steps in this SO link to compile a sample program using OpenCV2.4.0 in windows. I made a setup both in DEVC++ and NetBeans with Mingw. My sample Program is getting Compiled properly, but when I run the exe the application get crashes.
But In same machine I used opencv2.1.0 and the same sample program gets compiled and there is no crash while running it.
The below is the Sample Code I tried to execute:
#include "highgui.h"
using namespace std;
int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( "C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg" );
cvNamedWindow( "Sample", CV_WINDOW_AUTOSIZE );
cvShowImage( "Sample", img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Sample" );
}
UPDATE :
I follwed as the steps as moskito-x link to build the opencv and when I press "configure", I get the following error. And my make file is also 35kb in size.
Any suggestions to solve this?
Using the libs in "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib
You can not use the libraries that come with OpenCV-2.4.x.exe.
As some developers in forums and I find out. On some systems, the precompiled libs of "opencv 2.4.x" can not be used.
To compile your own programs, works, but it crashed if you try to run them. Until there are not functioning precompiled libs of "opencv 2.4.x , you have to compile opencv yourself.
Ignore so the folder "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib" completely.
As already pointed out you can't rely on precompiled binaries. I also had a lot of problems and finally ended up with compiling my own binaries. My setup was for Windows7, Eclipse CDT (Juno) and MinGW. You can check my post on Stackoverflow here
I guess this is an error related to memory management. Maybe because your'e releasing the window before the image. But anyhow you should use the OpenCV C++ interface, as this does a lot of stuff automagically. With the C++ Interface your code would look like this:
#include <opencv.hpp>
int main( int argc, char** argv ) {
cv::Mat img = cv::imread("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg");
cv::imshow("Sample", img);
cv::waitKey(0);
return 0
}

Getting Eclipse to recognize automatic CUDA kernel variables and functions

Is there a way to get Eclipse (Indigo) to know about the built-in variables and functions that are available to CUDA kernels?
Consider the following simple kernel
__global__ void myKernel()
{
int x = threadIdx.x;
__syncthreads();
}
The Eclipse IDE highlights "threadIdx" and "__syncthreads" with a "Symbol 'the built-in symbol' could not be resolved" error message. Is there a way to tell Eclipse these are actually implicitly defined?
flipchart is correct. #include <cuda_runtime_api.h> does the trick if the symbol __CUDACC__ is defined beforehand.
In cuda 11.3 you can add:
#include <device_launch_parameters.h>

Weird dynamic linking on iPhone

The following code crashes in an Xcode created template project.
int main(int argc, char *argv[])
{
uint64_t t64 = 100000;
double s = (double)t64; // Crash!
...
The crash is accompanied with the following console output and occurs on a 2.2.1 device but not on 3.0.1 devices. It occurs both compiling for Thumb or ARM.
dyld: lazy symbol binding failed: Symbol not found: ___floatundidf
Referenced from: /var/mobile/Applications/15E9DC65-324D-4C3A-8477-DC8CFFA67DC1/MyApp.app/MyApp
Expected in: /usr/lib/libgcc_s.1.dylib
dyld: Symbol not found: ___floatundidf
Referenced from: /var/mobile/Applications/15E9DC65-324D-4C3A-8477-DC8CFFA67DC1/MyApp.app/MyApp
Expected in: /usr/lib/libgcc_s.1.dylib
The problem only occurs with a Base SDK of 3.0, compiling for 2.2.1 is fine. Unfortunately I have 3.0 enhancements.
When you say it works on one iPhone project and not another, are you compiling the same code with different settings? If so I'd check to see what settings differ between the two to shed light on what might be at the root of the problem.
___floatundidf should be part of libgcc so it might be missing in the ARM version of that libary for the 2.2.1 SDK but present in 3.0.1 (hence the crash in the former but not the latter). You can use the nm tool to check for its existence in both. If it is missing from 2.2.1 you should file a bug with Apple.
It works if you do. Weird
int main(int argc, char *argv[]) {
uint64_t t64 = 100000;
double s = (double)(uint64_t)t64; // Crash!
...