Linux.com

ZarkCheung

ZarkCheung

  • Linux.com Member
  • Posts: 1
  • Member Since: 15 Aug 11
  • Last Logged In: 03 Sep 11

Latest Posts

Posted by
Topic
Post Preview
Posted
  • ZarkCheung
    RE: Am I C-ing this right?
    I really don't know what you want to express. If u write the code with C: [code] #ifdef __cplusplus /* or #if defined(__cplusplus) */ Extern "C" { #endif /* your code below */ #ifdef __cplusplus } #endif [/code] then , the c++ compiler can compile this c program. If u write the code with C++: [code] #include /* this can use a c head file */ #include /* this is a c++ head file */ [/code]
    Link to this post 15 Aug 11

    I really don't know what you want to express.

    If u write the code with C:


    #ifdef __cplusplus /* or #if defined(__cplusplus) */
    Extern "C" {
    #endif

    /* your code below */

    #ifdef __cplusplus
    }
    #endif

    then , the c++ compiler can compile this c program.

    If u write the code with C++:


    #include <pthread.h> /* this can use a c head file */
    #include <iostream> /* this is a c++ head file */

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board