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

£

£ukasz

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?
 
D

David Lowndes

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 .

Do you have a minimal code example that illustrates this problem?

Dave
 
C

Cholo Lennon

£ukasz said:
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?

Well, generic is a C++ CLI keyword and isn't context sensitive so I supose the
only way to solve the problem is renaming the variable(s) or use some pattern to
hide the offending names into a native code. Like David asked you, we need some
code to try a solution.

Regards
 
F

forever.zet

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?

There is keyword "__identifier", which enables you to use keywords as
identifiers.
So if you were able to replace all references to "generic" name with
"__identifier(generic)"
that could probably solve your problem.

Thanks,
Sergey Zyuzin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top