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. Linker error between projects

Linker error between projects

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
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.
  • K Offline
    K Offline
    KellyR
    wrote on last edited by
    #1

    Hi, I'm using C++ with MFC and VC++ 2005. My problem is this: I have two different projects, one dependent on the other. The first project compiles to produce a static lib. It also includes a namespace, let's call it "NAM" for the purpose of this question. The second project then includes the headers from the first project, and the static lib in its settings. This all seems fine, and the first project (the lib) compiles with no problems. However when I compile the second project, I receive linker errors for all of the namespace functions called in the first project's single .cpp file. So for instance, in project 1, I might have the function: NAM::Find_String(void) Which compiles just fine when I compile that project alone. But in the second project, I get this weird linker error that says: error LNK2001: unresolved external symbol _Find_String What am I doing wrong? It's like somehow the second project doesn't see the 'namespace' declared in the first project even though all the headers (there are only 3) are included and the lib is linked correctly.

    KR

    A 1 Reply Last reply
    0
    • K KellyR

      Hi, I'm using C++ with MFC and VC++ 2005. My problem is this: I have two different projects, one dependent on the other. The first project compiles to produce a static lib. It also includes a namespace, let's call it "NAM" for the purpose of this question. The second project then includes the headers from the first project, and the static lib in its settings. This all seems fine, and the first project (the lib) compiles with no problems. However when I compile the second project, I receive linker errors for all of the namespace functions called in the first project's single .cpp file. So for instance, in project 1, I might have the function: NAM::Find_String(void) Which compiles just fine when I compile that project alone. But in the second project, I get this weird linker error that says: error LNK2001: unresolved external symbol _Find_String What am I doing wrong? It's like somehow the second project doesn't see the 'namespace' declared in the first project even though all the headers (there are only 3) are included and the lib is linked correctly.

      KR

      A Offline
      A Offline
      Akt_4_U
      wrote on last edited by
      #2

      Please check whether you have properly included the staticlib in its settings. Second thing, you have to specify the path in which the static liv is located in Project->Settings->Link->Input. Also please check whether you have included the namespace of the first project in the second one.

      akt

      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