Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 12-11-2018, 20:09   #2221
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

Ouch, how did that happen? I will move it. Thanks again.

It compiled release ok. Some warnings. -Just if you are interested.
Attached Files
File Type: doc Compiled-Master-Results.doc (14.3 KB, 24 views)
rgleason is offline   Reply With Quote
Old 13-11-2018, 17:25   #2222
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

Now I know how it happened. I've started using OneDrive and when I installed the VM Machine and was installing Win10, a prompt came up for my OneDrive Account, since it was a setup program I thought well sure and logged in. The rest was history.

I made a directory "GitHub" as C:\Users\Rick\Documents\GitHub and then cloned to OpenCPN under that directory with GitHub Desktop for Windows. I also installed Visual Studio and that installation dropped a user directory in Documents folder.

OneDrive was active, at that time and started copying those directories up to the cloud! Some time later I noticed that the VM was hot and laboring trying to upload all of my OpenCPN local repository up to OneDrive Cloud. I believe that MS did this intentionally, but I may be wrong.

Undoing this structure took some doing because I did not want to delete or remove these directories but changing settings in OneDrive or signing out, so I first copied the GitHub and Visual Studio directories to new C:\Compile\GitHub and C:\Compile\Visual Studio directories where there is no chance they end up spirited away by OneDrive.

I then went into OneDrive settings and unchecked a bunch of OneDrive information I did not need on the VM. I could not uncheck Documents or Desktop which were also on OneDrive! So I just decided to sign the machine out of OneDrive completely. I don't need or want it here!

Git Desktop for Windows was redirected and I ended up deleting Opencpn and cloning it again. I will redirect Visual Studio too.

The VM is much happier now..... so please don't make that mistake by signing into OneDrive!!!!
rgleason is offline   Reply With Quote
Old 13-11-2018, 18:22   #2223
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

Tried compiling again and I am getting this error.
Line #include <cairo/cairo.h>

does not exist.
Attached Files
File Type: doc cairo.h-missing.doc (4.0 KB, 43 views)
rgleason is offline   Reply With Quote
Old 13-11-2018, 19:07   #2224
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,234
Re: Beta Test / Technical

Quote:
Originally Posted by rgleason View Post
Tried compiling again and I am getting this error.
Line #include <cairo/cairo.h>

does not exist.
You did not follow the compilation instructions correctly and are missing the dependencies.
nohal is offline   Reply With Quote
Old 14-11-2018, 02:52   #2225
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Beta Test / Technical

Quote:
Originally Posted by rgleason View Post
Tried compiling again and I am getting this error.
Line #include <cairo/cairo.h>

does not exist.
Rick,

There are two different buildwin dependency file sets. One set is just plain buildwin and you use that for building the 4.8.x tags.

For the HEAD of the master branch you must use a different set of files. These are the so-called .99 buildwin files. When you build O the correct set of files should always be found in opencpn\buildwin folder else you get missing file errors. This can be an easy step to forget. What I do is have both sets of files somewhere. I delete all buildwin files and then copy the appropriate files to the buildwin folder when switching which version I need to build.
transmitterdan is offline   Reply With Quote
Old 14-11-2018, 03:59   #2226
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Beta Test / Technical

Rick,

I should add that the 4.8.x buildwin files are here: http://sourceforge.net/projects/open...in.7z/download

Then for building the head of master branch you need to add these files: http://opencpn.navnux.org/build_deps...ildwin-4.99.7z to the buildwin folder. I replace old files when expanding the .99 files into buildwin. I am not sure if this is necessary but it works.

So I keep one folder with just the 4.8.x buildwin files and another folder with the .99 files added in. This makes is easier for me to switch between them.

For others reading this these files are for building with Visual Studio 2017. Earlier versions may need different dependency files. I only use VS2017 these days.
transmitterdan is offline   Reply With Quote
Old 16-11-2018, 04:17   #2227
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,245
Re: Beta Test / Technical

Rick...
Ever heard of the excellent O wiki? (Sorry.. I'm on a, do you say?, "spiteful" but very friendly mode today.)
https://opencpn.org/wiki/dokuwiki/do...s_dependencies


Håkan
Hakan is offline   Reply With Quote
Old 17-11-2018, 10:19   #2228
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

All of you have been a great help. I thought when I had undone the onedrive mess, I had removed all of the build directory, and unpacked the ocpnbuildwin for mui, but I will double check!

Thanks
rgleason is offline   Reply With Quote
Old 19-11-2018, 09:40   #2229
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

It appears that I unpacked ocpn-buildwin to the wrong directory!... build. It now works when unpacked to buildwin. (working too late?) Many thanks, including Hakan for his friendly reminder.
rgleason is offline   Reply With Quote
Old 19-11-2018, 18:32   #2230
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

Now having trouble with compiling Debug. Have copied all the files listed for Debug in the MSVC 2013 Opencpn v4.8.8 instructions as per those instructions. Some of those files in the list are not available in the new version. Hope this is the right thing to do.....


Still getting lib errors. I do have the path to wxwidgets set. Please see the attached errors.
Attached Files
File Type: doc MSVS-2017-Opencpn-Debug-Errors.doc (7.3 KB, 29 views)
rgleason is offline   Reply With Quote
Old 22-11-2018, 15:50   #2231
Registered User

Join Date: Mar 2011
Posts: 718
Re: Beta Test / Technical

Apologies if this is a misuse of this thread.

Currently finalising DSC & AIS support to the TwoCan plugin.

A question on coding standards. For example deriving an integer value from the 6bit encoding of a VDM/VDM message.

In OpenCPN, in AIS_BitString.cpp the function is coded as plain old 'C'

Code:
 int AIS_Bitstring::GetInt(int sp, int len, bool signed_flag)
{
    int acc = 0;
    int s0p = sp-1; // to zero base
    int cp, cx, c0, cs;

    for(int i=0 ; i<len ; i++)
    {
        acc = acc << 1;
        cp = (s0p + i) / 6;
        cx = bitbytes[cp]; // what if cp >= byte_length?
        cs = 5 - ((s0p + i) % 6);
        c0 = (cx >> (5 - ((s0p + i) % 6))) & 1;
        if(i == 0 && signed_flag && c0) // if signed value and first bit is 1, pad with 1's
            acc = ~acc;
        acc |= c0;
    }
    return acc;
}
I'm attempting to fill the 20 year gap in my C++ coding skills, so my question is which of the these four equivalent C++ functions is preferable to use in my plugin in terms of both performance and readability/maintainability ?

using [] operator
Code:
 int GetIntegerV1(std::vector<bool> &binaryData, int start, int length) {
    int result = 0;
    for (int i = 0; i < length; i++) {
        result += binaryData[i + start] << (length -1 - i); 
    }
    return result;
}
using an iterator
Code:
 int GetIntegerV2(std::vector<bool> &binaryData, int start, int length) {
    int result = 0;
    std::vector<bool>::iterator it;
    for (it = binaryData.begin() + start; it != binaryData.begin() + start + length; ++it) {
        result += *it << (length - 1 - std::distance(binaryData.begin() + start, it));
    }
    return result;
}
using an iterator and auto
Code:
 int GetIntegerV3(std::vector<bool> &binaryData, int start, int length) {
    int result = 0;
    for (auto it = binaryData.begin() + start; it != binaryData.begin() + start + length; ++it) {
        result += *it << (length - 1 - std::distance(binaryData.begin() + start, it));
    }
    return result;
}
using for_each and lambda function
Code:
 int GetIntegerV4(std::vector<bool> &binaryData, int start, int length) {
    int result = 0;
    int index = 0;
    std::for_each(binaryData.begin() + start, binaryData.begin() + start + length, [&result, &index, &length](int i) { result += i << (length - 1 - index); index++; });
    return result;
}
Note that binaryData holds similar data (bit values) decoded in a similar way that the to_6bit function does in AIS_Bitstring.CPP.

The more I relearn C++ and the new STL and std::algortithm functions, I'm not yet entirely convinced that adopting purer C++ improves the readabilty/maintainability of the code although it does reduce the amount of code may reduce coding errors through the increased use of standard and well tested functions.

Thoughts/ guidance ?
stevead is offline   Reply With Quote
Old 22-11-2018, 18:38   #2232
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,463
Re: Beta Test / Technical

steavad...


I wrote this code, years ago.



Others may disagree (Nohal?, boat_alexandra?), but I find some recent c++ syntax to be obtuse in the extreme. Impossible to debug in an IDE. And for short functions like this, I don't believe that the newer syntax will produce measurably faster code, anyway.



So there is no real effort (by me) to convert older working code in OCPN to modern c++ syntax. Let it be, and move ahead with features and bug fixes.

On the other hand, there are some very useful methods in stdlib, which I plan to use in new code.

But, of course, I'm pretty "old school".


Dave
bdbcat is offline   Reply With Quote
Old 22-11-2018, 19:09   #2233
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,234
Re: Beta Test / Technical

I personally prefer iterators over for loops and vectors over arrays these days. I even like auto for productivity, although it may make the code less understandable at first sight without a good IDE. I somehow can't get used to lambdas, even after all the years they are around. But have to admit that unlike in the example discussed here, there are cases where they really make stuff much easier, for example in https://docs.wxwidgets.org/3.1.1/cla...0903daabe32197

Pavel
nohal is offline   Reply With Quote
Old 27-11-2018, 07:37   #2234
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

From the Visual Studio 2017 Command Prompt
in the build directory, entering
Code:
cmake --build . --config debug
I get these errors after this line appears:


Quote:
Creating library C:/Compile/Github/OpenCPN/build/Debug/opencpn.lib and object C:/Compile/Github/OpenCPN/build/Debu
g/opencpn.exp
Quote:
Originally Posted by rgleason View Post
Now having trouble with compiling Debug. Have copied all the files listed for Debug in the MSVC 2013 Opencpn v4.8.8 instructions as per those instructions. Some of those files in the list are not available in the new version. Hope this is the right thing to do.....

Still getting lib errors. I do have the path to wxwidgets set. Please see the attached errors.
See this Post for the attached file



the path to "C:\wxWidgets-3.1.1" exists (double checked) and I've entered the System Variable

Code:
wxWIDGETS_ROOT_DIR  c:\wxWidgets-3.1.1
rgleason is offline   Reply With Quote
Old 27-11-2018, 09:23   #2235
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,711
Images: 2
Re: Beta Test / Technical

Rebooted the VM and restarted VirtualBox. Changed to MUI branch and tried to compile for debug. Same 30 errors.
Should I just delete and git clone again?
rgleason is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beta Marine Diesel michaelmrc Engines and Propulsion Systems 48 23-03-2016 13:44
Need some technical advice....antennas. Just a Tinch Marine Electronics 15 01-12-2007 15:57
Blue Sea Systems Technical Brief GordMay Electrical: Batteries, Generators & Solar 0 16-03-2007 04:16
technical difficulties witchcraft The Sailor's Confessional 1 30-05-2005 14:09
Dow Corning Technical Manual GordMay The Library 0 12-04-2005 16:25

Advertise Here


All times are GMT -7. The time now is 12:35.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.