I recently created a shared lib. The code is all in C++ Several
classes with a main() (well not main, but the main function, anyway). I
have a seperate c program that I am working on that I thought it would
be handy to use the C++ code. I included the h file and did the
standard -lmylib when compiling, but it doesn’t work. I have never
tried this before and so I am curius. Is there a way to do this? Can
you include a C++ lib into a C app or can it only go the other way
around. Anyone know of any references I could look at? Suggestions?
Thanks
-Benjamin
This isn’t an SDL related question at all…
But…
There should definitely be a way to make it work. Did you try extern "C"
in the header file to determine linkage parameters? I have to say I have
never tried a C++ library with C code.
Try g++ instead of gcc even that may do something weird to make it work.
DaveOn Tue, 27 Jun 2000, Benjamin Meyer wrote:
I recently created a shared lib. The code is all in C++ Several
classes with a main() (well not main, but the main function, anyway). I
have a seperate c program that I am working on that I thought it would
be handy to use the C++ code. I included the h file and did the
standard -lmylib when compiling, but it doesn’t work. I have never
tried this before and so I am curius. Is there a way to do this? Can
you include a C++ lib into a C app or can it only go the other way
around. Anyone know of any references I could look at? Suggestions?
Thanks
-Benjamin