Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22927 closed enhancement (fixed)

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 (3)

comment:1 Changed 10 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to jameskyle@…
Port: newmat added

comment:2 Changed 10 years ago by jameskyle@…

Resolution: fixed
Status: newclosed

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 10 years ago by ryandesign (Ryan Schmidt)

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.