Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Compiling C and C++ files together

Compiling C and C++ files together

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelpannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AmbiguousName
    wrote on last edited by
    #1

    Hello. I am trying to add some .C files in a new cpp project. Doing so gives me the fatal error C1853 i.e. precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa). Now I have read a knowledge base article on microsoft forum about it which proposed 4 diffferent resolutions. I tried all of them but could not succeed (may be I couldn't understand what was required to be done). Can someone list down the steps to included .C files in cpp project. Thanks for your input.

    This world is going to explode due to international politics, SOON.

    L L 2 Replies Last reply
    0
    • A AmbiguousName

      Hello. I am trying to add some .C files in a new cpp project. Doing so gives me the fatal error C1853 i.e. precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa). Now I have read a knowledge base article on microsoft forum about it which proposed 4 diffferent resolutions. I tried all of them but could not succeed (may be I couldn't understand what was required to be done). Can someone list down the steps to included .C files in cpp project. Thanks for your input.

      This world is going to explode due to international politics, SOON.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Check properties for each of these files and set the compiler option for Precompiled Headers to "not using precompiled headers".

      1 Reply Last reply
      0
      • A AmbiguousName

        Hello. I am trying to add some .C files in a new cpp project. Doing so gives me the fatal error C1853 i.e. precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa). Now I have read a knowledge base article on microsoft forum about it which proposed 4 diffferent resolutions. I tried all of them but could not succeed (may be I couldn't understand what was required to be done). Can someone list down the steps to included .C files in cpp project. Thanks for your input.

        This world is going to explode due to international politics, SOON.

        L Offline
        L Offline
        leon de boer
        wrote on last edited by
        #3

        When using C files in a C++ unit you need to put an extern C around there include like this #include "otherstuff" // you can include other c++ unit before it extern "C" { #include "Someunit" // include you c unit } #include "morestuff" // you can include other c++ units after it

        In vino veritas

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups