Announcement

Collapse
No announcement yet.

C to C++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    C to C++

    Okay...I have some libraries(made in c) which I am trying to use in c++. I am using borland c++ 5.02. And I keep getting compilation error. They work perfectly fine as long as i create a c project and not c++.


    errors go something like:

    BYTE cannot start a parameter declaration
    Type name expected
    HANDLE cannot start a parameter declaration
    ....
    ....

    any ideas???
    I don't know where I am going. I don't know what for but I am making progress.

    #2
    well...for the comiler apparently it is a syntax error when u compile it as a c++ code but the syntax is perfectly fine cause' it works when you compile it as a c code...

    u want me to send u the code? and perhaps u can try it on your own?
    I don't know where I am going. I don't know what for but I am making progress.

    Comment


      #3
      You are not renaming your file of C code to .cpp extension, are you?

      Comment


        #4
        ^ i am not sure what exactly did you mean by that but Yes I am renaming the files from c to cpp.
        I don't know where I am going. I don't know what for but I am making progress.

        Comment


          #5
          ^ Thats the prob. C is not a subset of C++. A small example is that you cannot declare a struct having name class in C++. But thats a small example, there are other low level issues which I don't want to discuss. If you are interested, read "The C++ Programming Language" by Bjarne Stroustrup.

          C is not a complete subset of C++, its a different language. However C is interoportable with C++. That is, you can call each other's function and compile them together with a single compiler. So include your C file as is it in your C++ project and call those functions using extern.

          Comment

          Working...
          X