What is the difference between #import and #include in C++?

devquora
devquora

Posted On: Feb 22, 2018

 

The statement #include is used in C++ to include the source file or import the header files containing definitions of function declarations, macro definitions to be shared between several source files and variables using the preprocessor. On the other hand, #import is a Microsoft-specific statement used for binary library like DLL or .Lib files. It is very similar to include that it load all the header function definitions from the DLL file so that the user can use the header file just like the case with #include.

The statement #include allows the user to include the same file many times while #import ensures that the preprocessor only includes a file once.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    C++ Interview Questions

    Explain what is OOP?

    Object-oriented programming (OOP) is a type of computer programming, also more commonly known as software design, in wh..

    C++ Interview Questions

    What is ‘this’ pointer?

    The ‘this’ pointer is passed as a hidden argument to all the non-static member method calls and is available as a l..

    C++ Interview Questions

    What are the vectors in C++?

    Vectors are a kind of data structure sequence containers, which represent arrays but can change in size. Just like arra..