How to Integrate matlab with Qt on windows 7 - c++

I'm stuck in a very important part of my project as i need to call Matlab functions form Qt 4.7.3 since i use the Qt for my interface (UI) and i want to call matlab function that return results and it appears on Qt UI
i searched many and many and i didn't find any thing that can help even with traditional C++

this will get you started. Basically you compile a dll from within Matlab, and call the dll from your c++ code. Note however: it can take a looong time to load the dll since it loads the matlab runtime etc. Also, all computers you want to use it on need the matlab runtime installed.
A newer option is this one. Haven't tried it yet so I cannot comment on it but it looks promising.

See the documentation for calling Matlab from C++. You'll need to visualize the results yourself, if you want to visualize them in Qt.

Related

Can I use C++ with UDK?

Can I use C++ with UDK? I know they mention unrealscript on their page but I've also heard that C++ can be used instead, is that so?
It depends. If you use the free version of UDK you can't code the game in C++, but you can include self written DLLs which can be written in C++.
If you become a licensee you get the C++ source code of the unreal engine 3 and then are able to program in C++.
But getting the source code is very expensive, several grand if I recall correctly, so you are probably stuck with UnrealScript for the majority of your time.
More information about how use DLL:
Calling DLLs from UnrealScript (DLLBind)
Unreal Engine 4 was released recently for 20$/month + 5% of profits, and you get access to its source code which you can compile with your code together.
However, you won't find the UnrealScript component, the only scripting solution available is the GUI-based Kismet-like thingy.

Calling MATLAB or Scilab function from C++ project

I'm trying to access some Scilab functions from my C++ project. I'm working on Windows 7. How can I do that.?
For example,
function [r] = fun(a,b)
r =a+b;
endfunction
How can I tell my C++ project, it should run the Scilab function "fun" and give the parameter a=4, b=9. so that I get their value?
If somebody did this for MATLAB, I think this will be the same here (without using its engine).
A lead would be to use Julia that is quite similar to MATLAB. I'm not sure it's possible yet to compile to a library. The project is based on LLVM so maybe you can generated C code and integrate it with your code.
For MATLAB, you can use the MATLAB compiler, and you should be able find some examples on the MATLAB website.
You will need the Scilab runtime aside, but call_scilab is probably what you are looking for.

compile and run c++ code runtime

Does anyone know how to compile your c++ code wich you write while your program is already running?
And later i would like to run that code.
I want to do this because I am trying to make a game that woul teach you programing and so the user would have to write the code while the game is running and test it.
Thanks for any help
You'd have an easier time if you chose a language that was designed with embedding in mind - like LUA or python. For C++, you'd have to go for something extremely clumsy and fragile like invoking an external compiler (which is also a logistics nightmare when shipping your game), or something as complex as integrating a compiler in your game (probably doable with llvm components, but...)
Also, for "teaching programming", C++ probably isn't the best language :)
You have to call the compiler to compile and link the user-entered code. This has to be made either into an executable that is then run from another process you create, or as a library that you dynamically load and call.
How this is done is different on POSIX platforms (like Linux and OSX) and Windows.

Run MFC program on Linux

I have a rather large MFC based program. I have been tasked to get it running on Linux. I have explained that this will require a re-write of the program either into straight C++ with STL (more work), or into Qt/C++ (less work). I am now told that I need to write wrappers to get every MFC class working in Linux and use preprocessor directives to only compile what is needed in either Linux or Windows. I explained that we are having a communication disconnect and that I believed this to be more work than rewriting the entire project from scratch (which I would not have to do to convert to Qt).
Any good arguments out there to help explain this issue? Am I wrong?
If you don't want a full rewrite, you could try compiling against Winelib. Most things should just work and then since you have the source, you can work around the parts that don't.
The obvious solution is to run the code unchanged and un-recompiled on WINE.
A simple (kludgy) solution is to run an entire Windows VM on the Linux system, and deploy the application as a virtual hard-drive, but that will require a Windows license and is little different than simply connecting a Windows system to a Linux network.
If you must re-write, wxWidgets would be more familiar to an MFC developer than Qt perhaps.
Here is an article on porting MFC apps to Linux that considers the use GTK+, Qt and wxWidgets. It also discusses why you should consider and try WINE before any of those options. The author talks about future articles on the subject, but appears to have written nothing further since 2004.
The sources for MFC and ATL total to over 500000 lines of code, and most of the functionality of this code is actually provided by the Windows API itself. How many lines of code can you write in a day? The scale of what you are being asked to do is simply impractical, even if you're only implementing a small subset of MFC.

CUDA wrapper for Qt

Qt have released a nice wrapper for Opencl ( QtOpencl ) which does a very good job of hiding a lot of boiler plate and making OpenCL play nicely with Qt's display widget and Opengl.
But there are a few things that I can do better in Cuda than OpenCL and the Cuda tools are much more mature.
It's relatively easy to make a simple Cuda C++ wrapper and integrate into the Qt build process but I wondered if anybody had done anything more? Ideally an equivalent QtCuda library.
The Qt people aren't interested in Cuda support because it's not cross platform enough
edit: Just for search, there is a Qt CUDA wrapper for openGL PBO. It's based on the Dr Dobbs simplePBO example. There are a couple of bugs fixes needed to make it play nicely with Cuda4 but it's a good start.
ps there is no way to contact the author of the blog and comments don't work - if he finds this let me know and i will send the fixes.
The Qt people aren't interested in Cuda support because it's not cross platform enough
Exactly. If you want to ignore this, you don't understand Qt's philosophy. And why create even more legacy-code, while it's easy to translate your existing kernels to OpenCL with MultiscaleLab Swan?
But the source of the library is free to download and used as a base.
The way I did it was to build a DLL in Visual Studio, warped CUDA Function call among normal C exported functions. They used LoadLibrary and GetProcAddress from QT IDE. All in all, it worked quite well.