Opened 7 years ago

Closed 6 years ago

Last modified 4 years ago

#11855 closed Library Submissions (fixed)

generic gives problems in C++/CLI

Reported by: gast128@… Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

it seems that Boost.Filesystem uyses the name 'generic' with clashes with C++/CLI. I know this is not really a bug, but this is very unhandy and probably makes Boost.Filesystem already unusable in these contexts.

1>c:\boost_1_60_0\boost\filesystem\path.hpp(458): error C2059: syntax error : 'generic'

There is a link on www (can't paste links since trac reports these as spam): 'Visual Studio 2008 error C2059: syntax error : 'generic' '

Change History (11)

comment:1 by anonymous, 7 years ago

Any update on this issue, I am also facing same?

comment:2 by Michael Rasmussen <Michael.Rasmussen@…>, 7 years ago

C++/CLI has an extension called __identifier (See https://msdn.microsoft.com/en-us/library/hzc8ytsz.aspx) that can be used to work around it. Something like the following should work:

#ifdef __cplusplus_cli
#define generic __identifier(generic)
#endif
#include <boost/filesystem.hpp>
#ifdef __cplusplus_cli
#undef generic
#endif

comment:3 by Stefan Mianome <smianome@…>, 7 years ago

i think it is a bad idea (and unnecessary) to use C++/CLI keywords in boost code. it would be nice if it could be fixed for future boost versions.

comment:4 by Serear, 6 years ago

Is there a fix planned for the next release ?

comment:5 by anonymous, 6 years ago

Facing the same issue here

comment:6 by anonymous, 6 years ago

This is still a problem in boost 1.61.0 when compiling with Visual Studio 2015. Please consider the name generic_path() for this function.

comment:7 by anonymous, 6 years ago

Generic_path() is a great option. Possible to put in next build?

comment:8 by Beman Dawes, 6 years ago

Resolution: fixed
Status: newclosed

Fixed in develop. Should be in master in time for 1.63.0.

The old generic() name is deprecated but still supported. It and other deprecated functions can be turned off by defining BOOST_FILESYSTEM_NO_DEPRECATED.

Thanks,

--Beman

comment:9 by TomerP <thetomerpeer@…>, 5 years ago

Was this actually fixed? I'm getting the same error with boost 1.64

comment:10 by anonymous, 4 years ago

Hi, Im having the same problem. If I define BOOST_FILESYSTEM_NO_DEPRECATED the code compiles but then I get a runtime exception when the form is initialized.

comment:11 by anonymous, 4 years ago

Having this issue with boost 1.67.

Note: See TracTickets for help on using tickets.