sandyre / libopencad

OpenSource library under X/MIT license to work with CAD files (DWG/DXF). Please use repository linked below, this one is abandoned.
https://github.com/nextgis-borsch/lib_opencad
MIT License
197 stars 63 forks source link

Failed to build library on Windows #36

Open rudolfninja opened 7 years ago

rudolfninja commented 7 years ago

Has anyone tried to build this library for Windows? When I'm trying to build this lib for Windows I see a lot of syntax errors (for about 1500). So could you please advise here? I use MS VS 2017. Here are steps I'm following to build library: 1) Run cmake CMakeLists.txt 2) Launch libopencad.sln 3) Build the solution in microsoft visual studio 2017

I attached screenshot with the problems. image

sandyre commented 7 years ago

I do not have any Windows machine nearby, so it will take some time for investigation. Thanks for your report.

Sc07713 commented 7 years ago

I had the same issue here, I could use cmake against it. make didnt work for me, so I launched the sln in vs. Linked the library and it was filled with errors.

sandyre commented 7 years ago

I've got laptop with Windows, so will fix the build in a next few days. Thanks for your patience.

Sc07713 commented 6 years ago

Hi,

I just wanted to follow up, how far are we off this fix?

sky-69 commented 6 years ago

hi,

I manage to compile libopencad.dll on windows with mingw64 and msys. I have just modify one line in cadheader.cpp, in fact unix is a macro on windows so in funciotn addValue (line 470) : `int CADHeader::addValue( short code, long julianday, long milliseconds ) { // unixday -> julian return ( unixSecs / 86400.0 ) + 2440587.5; // julian -> unixday return (julian - 2440587.5) * 86400.0

double seconds     = double( milliseconds ) / 1000;
double unixday        = ( double( julianday ) - 2440587.5 ) * 86400.0;
time_t fullSeconds = static_cast<time_t>(unixday + seconds);
return addValue( code, CADVariant( fullSeconds ) );

}`

install CMake for windows then, in libopencad directory

C:/CMake/bin/CMake.exe -DBUILD_SHARED_LIBS=ON -G "MSYS Makefiles" CMakeLists.txt then make

It works for me, compilation is ok, link also, i have not tested runtime...

rudolfninja commented 6 years ago

Hi,

Great news. Thanks. I'll try it.

2018-01-11 10:44 GMT+03:00 Chevallier notifications@github.com:

hi,

I manage to compile libopencad.dll on windows with mingw64 and msys. I have just modify one line in cadheader.cpp, in fact unix is a macro on windows so in funciotn addValue (line 470) : `int CADHeader::addValue( short code, long julianday, long milliseconds ) { // unixday -> julian return ( unixSecs / 86400.0 ) + 2440587.5; // julian -> unixday return (julian - 2440587.5) * 86400.0

double seconds = double( milliseconds ) / 1000; double unixday = ( double( julianday ) - 2440587.5 ) * 86400.0; time_t fullSeconds = static_cast(unixday + seconds); return addValue( code, CADVariant( fullSeconds ) );

}`

install CMake for windows then, in libopencad directory

C:/CMake/bin/CMake.exe -DBUILD_SHARED_LIBS=ON -G "MSYS Makefiles" CMakeLists.txt then make

It works for me, compilation is ok, link also, i have not tested runtime...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sandyre/libopencad/issues/36#issuecomment-356852283, or mute the thread https://github.com/notifications/unsubscribe-auth/AeJknF4y0b1gamudi3zIeJpkbUHmVc-Lks5tJbvkgaJpZM4PMvQq .

SSHeRun commented 6 years ago

Hi, I try the solution,but also be fail.

20180321205249

SSHeRun commented 6 years ago

hi, today,I and my partners try some new ways,and we built it successfully in vs 2017 this is my github :https://github.com/SSHeRun/Libopencad-built-in-windows- my blog:https://blog.csdn.net/Caoyang_He/article/details/79660336

GoosebumpsFactory commented 3 years ago

@sandyre Thank you for releasing this library. Like previous posters on this thread I cannot compile the VS Studio project generated by cmake. I get the same errors as this post. Is there a plan to fix this bug? Thanks.