Problem with compiling managed c++ code with added c - library with variable named generic

Problem with compiling managed c++ code with added c - library with variable named generic

am 21.01.2008 15:34:58 von lzabik

I have project that uses managed c++ where I use c - library, this library
contains some variables named generic, during compilation I get error: Error
1 error C2146: syntax error : missing ';' before identifier 'generic',
Problem is with name generic, unfortunately I cannot change this
name .How to solve this problem?
What to do to make it work?

--
Thanks,
£ukasz

RE: Problem with compiling managed c++ code with added c - library wi

am 21.01.2008 18:29:04 von PRSoCo

The error means you've missed a semicolon somewhere.

For example

int x = 10
generic += 1;

....would generate that same error.

Otherwise, post the code that has the problem and we can probably tell you
explicitly where your problem is.
--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#


"£ukasz" wrote:

> I have project that uses managed c++ where I use c - library, this library
> contains some variables named generic, during compilation I get error: Error
> 1 error C2146: syntax error : missing ';' before identifier 'generic',
> Problem is with name generic, unfortunately I cannot change this
> name .How to solve this problem?
> What to do to make it work?
>
> --
> Thanks,
> £ukasz
>
>
>
>

Re: Problem with compiling managed c++ code with added c - library with variable named generic

am 21.01.2008 21:40:58 von pvdg42

"£ukasz" wrote in message
news:fn2au0$kec$1@nemesis.news.tpi.pl...
> I have project that uses managed c++ where I use c - library, this library
> contains some variables named generic, during compilation I get error:
> Error
> 1 error C2146: syntax error : missing ';' before identifier 'generic',
> Problem is with name generic, unfortunately I cannot change this
> name .How to solve this problem?
> What to do to make it work?
>
> --
> Thanks,
> £ukasz
>
There's nothing wrong with using the identifier "generic" for your own
purposes in C#. While testing, I ran across this, which caused exactly the
error you cite:

I mistyped the assignment operator (=) in this statement:

int generic = 33;

as the subtraction operator (-):

int generic - 33;

Any chance you did the same?

Re: Problem with compiling managed c++ code with added c - library with variable named generic

am 22.01.2008 18:57:49 von pvdg42

"PvdG42" wrote in message
news:u2U357GXIHA.4696@TK2MSFTNGP05.phx.gbl...
> There's nothing wrong with using the identifier "generic" for your own
> purposes in C#. While testing, I ran across this, which caused exactly the
> error you cite:
>
> I mistyped the assignment operator (=) in this statement:
>
> int generic = 33;
>
> as the subtraction operator (-):
>
> int generic - 33;
>
> Any chance you did the same?
Please ignore the above!
I somehow got the idea you were using C#.
generic is obviously a keyword in C++/CLI
You received an answer in a different group suggesting _Identifier. Follow
up on that.