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. fatal error LNK1120: 1 unresolved externals

fatal error LNK1120: 1 unresolved externals

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

    hi, I have wrote a static function and i have declared static int variable in a class.initally i have set the value of variable to zero,in another function which is not static , i have incremented this varible by one,in the first static funtion ,i have written a if condition if(m_inCoun==1){do this };i have decremented the varible count by one ,in the if condition.When i compile the code i getting LNK1120:error..what could be the reason...? Thanks in before James

    G 1 Reply Last reply
    0
    • R RockyJames

      hi, I have wrote a static function and i have declared static int variable in a class.initally i have set the value of variable to zero,in another function which is not static , i have incremented this varible by one,in the first static funtion ,i have written a if condition if(m_inCoun==1){do this };i have decremented the varible count by one ,in the if condition.When i compile the code i getting LNK1120:error..what could be the reason...? Thanks in before James

      G Offline
      G Offline
      Graham Bradshaw
      wrote on last edited by
      #2

      You need to declare the actual instance of the variable as well as declaring it in class. Typically this is done in the .cpp for the class: so if the .h had int m_inCoun; the .cpp would have (at the top, before the implementation code) int CYourClassName::m_inCoun = 0;

      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