473,385 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with compiling managed c++ code with added c - library

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 that in dotNet generic is a keyword, and I cannot change this
name becouse I have only lib file and includes.
How to solve this problem?

--
pozdrawiam Łukasz

Jan 21 '08 #1
1 1651
On Jan 21, 2:29*pm, "Łukasz Z±bik" <lza...@omnis.plwrote:
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 that in dotNet generic is a keyword, and I cannot change this
name becouse I have only lib file and includes.
How to solve this problem?
Are you sure that you don't mean C++/CLI?
No matter:
Add a layer of indirection (the solution to
so many software problems). Write an
ordinary C++ wrapper that avoids using
"generic" in its interface, and call the
wrapper from your "Managed C++".

ie:
library.h
---------
extern void generic(int);

wrapper.h
---------
extern void wrap_generic(int);

wrapper.cpp
-----------
#include "wrapper.h"
#include "library.h"
void wrap_generic(int x) {
generic(x);
}

managed_cpp.cpp
---------------
#if 0 // won't work
#include "library.h" // keyword - bzzt
:
generic(23); // keyword - bzzt
#endif

// this is ok
#include "wrapper.h"
:
wrap_generic(23); // fine

HTH

Jan 21 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mike S. | last post by:
Hello, Has anyone had success compiling the informixdb-1.3 module under python 2.2? It seems the absense of makefile.pre.in in python 2.2 causes the break under py2.2. Is there an easy way...
7
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting...
0
by: Ola Sprauten | last post by:
I got a .NET class library project where I have written a managed wrapper for some unmanaged code. The managed wrapper is then used by a c# .net application. The problem I am having is that the...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
1
by: Steve Marsden | last post by:
Hi All the information I had read suggested that if you had an existing C project that you wished to change to managed code all you had to do was use the /clr switch and then over time you could...
13
by: Lee Newson | last post by:
Hi, I have just written my first application using VB.NET. The app works fine when i am running it within .NET for debugging purposes, however when i try to run the app from the .exe file that...
2
by: zamir.khan | last post by:
Hello all, New to the groups, sorry if this the wrong forum/etiquette. I am coding a c++ application that requires the use of a timer-triggered event handler. I decided to use the timer provided...
0
by: =?Utf-8?B?Y2hyaXNiZW4=?= | last post by:
Hi, I am getting quite frustrated while trying to wrap a C++ static library using managed C++ to a dll. Here are what I tried first, try to wrap it is a normal dll with some functions. seems...
1
by: Łukasz | last post by:
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 ';'...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.