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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Linking C library in C++ application

Linking C library in C++ application

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
2 Posts 2 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.
  • Y Offline
    Y Offline
    Yashusid
    wrote on last edited by
    #1

    I am linking a C library in C++ application. i have declared function in my c.h #ifdef __cplusplus extern "C" { #endif int fun(int,int); #ifdef __cplusplus } #endif created my c.lib now in my capp.cpp i have included this c.h as #include "c.h" and i have linked the c.lib and calling this fun function in my cpp application as int x=fun(2,3); directly ... would this work ?? how can i be sure that the library is linked propery ??

    S 1 Reply Last reply
    0
    • Y Yashusid

      I am linking a C library in C++ application. i have declared function in my c.h #ifdef __cplusplus extern "C" { #endif int fun(int,int); #ifdef __cplusplus } #endif created my c.lib now in my capp.cpp i have included this c.h as #include "c.h" and i have linked the c.lib and calling this fun function in my cpp application as int x=fun(2,3); directly ... would this work ?? how can i be sure that the library is linked propery ??

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      Should work. Sounds like you've done everything correctly.

      Steve

      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