dkazanc / TomoPhantom

Software to generate 2D/3D/4D analytical phantoms and their Radon transforms (parallel beam) for image processing
https://dkazanc.github.io/TomoPhantom/
Apache License 2.0
116 stars 53 forks source link

Error with "compile_mex_windows.m" #111

Closed RSirimanne closed 2 years ago

RSirimanne commented 2 years ago

Hello,

I have been running into issues with building the MATLAB wrapper on windows. When running the file "compile_mex_windows" I'm met with the following error:

"Error using mex C:\Users\rvs6146\AppData\Local\Temp\mex_1744130824622514_3484\TomoP2DModel.obj:TomoP2DModel.c:(.text+0x7ea): undefined reference to imp_TomoP2DObject_core' C:\Users\rvs6146\AppData\Local\Temp\mex_1744130824622514_3484\TomoP2DModel.obj:TomoP2DModel.c:(.text+0xc5a): undefined reference to `imp_TomoP2DObject_core' collect2.exe: error: ld returned 1 exit status

Error in compile_mex_windows (line 26) mex TomoP2DModel.c TomoP2DModel_core.c utils.c COMPFLAGS="\$COMPFLAGS -fopenmp -Wall -std=c99"

I have tried to debug this myself and used the second approach using TDM-GCC with no luck unfortunately. Do you by any chance have an idea as to why this may be happening? As well as a possible work around? I had seen a similar issue brought up by a user "bort" here: [https://www.mathworks.com/matlabcentral/fileexchange/63603-tomophantom] but was unable to see a solution.

Many thanks in advance :)

dkazanc commented 2 years ago

Hi there, thanks for reporting this. To replicate I will need a bit of time to reach Windows + Matlab as this way of compiling the scripts is a bit of a legacy. Could you try compiling using Cmake on Windows as in readme instructions? This should work...

RSirimanne commented 2 years ago

Thanks for the quick response! And sure thing, I'll go that route :)

dkazanc commented 2 years ago

Hi, I was able to compile using compile_mex_windows in Matlab 2018a and Microsoft Visual C++ 2017. You could try installing Microsoft visual and chose the compiler it in the mex configuration step in Matlab. Anyway here are compiled mex's, try using them directly if your compilation is not working. They might just work out of the box. compiled.zip

RSirimanne commented 2 years ago

Wow! Thanks for taking the time, I'm gonna go ahead and give this a try and get back to you. Really appreciate this :)

RSirimanne commented 2 years ago

Just got it running! Thanks a bunch, I'll go ahead and close this issue :)