New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #22927 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

newmat 10 please enable the use of namespace

Reported by: slask@… Owned by: jameskyle@…
Priority: Normal Milestone:
Component: ports Version: 1.8.1
Keywords: Cc:
Port: newmat

Description

Newmat is capable of using c++ namespaces. This needs to be enabled during build, otherwise one gets linker errors if one uses the namespace in user code.

Namespaces is a good thing, and should in my opinion be enabled by default for these kind of packages. I understand if turning it on breaks other peoples build, but in that case one may use a variant.

I suggest that the use of namespace is turned on, and if this is not possible because of breaking other applications, adding a variant.

I made the change locally with the "port edit" command, appending the lines configure.cxxflags-append -Duse_namespace to the portfile.

Change History

comment:1 Changed 3 years ago by macsforever2000@…

  • Owner changed from macports-tickets@… to jameskyle@…
  • Port set to newmat

comment:2 Changed 3 years ago by jameskyle@…

  • Status changed from new to closed
  • Resolution set to fixed

I've added the build options. I tested on my system though and namespaces seem to work with or without this flag.

I get no compile or runtime errors on this regardless of flags, could you provide an example please:

#include <newmat/newmat.h>
#include <iostream>

using namespace std;

namespace foo {
  struct Foo {
    int bar;
    int bah;
    LogAndSign sign;
  };
}

int main (int argc, char const *argv[])
{
  cout << "time be time" << endl;
  foo::Foo myfoo;
  Real baz(26);
  

  cout << myfoo.sign.Value() << endl;
  
  return 0;
}

comment:3 Changed 3 years ago by ryandesign@…

James committed the change in r62813 and I committed a revbump in r62851 because this presumably changes how the software builds.

Note: See TracTickets for help on using tickets.