Thread: using c++ in c code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    I didn't say the C++ modules are compiled with a C compiler. You have to use a c++ compiler to do that, such as g++, Dev-C++, VC++ 6.0/7.0, and many other c++ compilers. c++ compilers can compile both c and c++ modules, and it knows how to compile by the file extension (*.c for C code and either *.cpp or *.cc for c++ code). Many c++ compilers have additional options to recognize other file extensions.

    If you want to link both C and C++ into the same executable, then yes, the C runtime libraries will also be linked into the program.

    [edit]The above assumes that the source code for all *.c and *.cpp files is available and can be modified as needed. In OP case, I don't think he does -- it appears he may be trying to call c++ library functions from c, which as you said before, cannot be done.
    Last edited by Ancient Dragon; 10-26-2005 at 01:09 PM.

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    61
    Thanks for the help everyone. It seems that my problem is not trivial to solve, so I'll try to code my own memory manager library.

    btw : as a side-question :
    in c++, when you declare a function like this :

    int &function(...);

    hen what does the & mean?
    Last edited by hannibar; 10-27-2005 at 04:21 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM