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. Global value... [modified]

Global value... [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
6 Posts 4 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.
  • S Offline
    S Offline
    Shah Satish
    wrote on last edited by
    #1

    Hi !!! I have two cpp file..like Confwebd.cpp and arxmain.cpp.. I have cstring my text; in Confwebd.cpp now i want to use this string value in arxmain.cpp .. Can any body know how can i make it ?? Thanks Shah

    M D L 3 Replies Last reply
    0
    • S Shah Satish

      Hi !!! I have two cpp file..like Confwebd.cpp and arxmain.cpp.. I have cstring my text; in Confwebd.cpp now i want to use this string value in arxmain.cpp .. Can any body know how can i make it ?? Thanks Shah

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      See the FAQ 6.2 How do I share a global variable among my .CPP files?[^]

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

      1 Reply Last reply
      0
      • S Shah Satish

        Hi !!! I have two cpp file..like Confwebd.cpp and arxmain.cpp.. I have cstring my text; in Confwebd.cpp now i want to use this string value in arxmain.cpp .. Can any body know how can i make it ?? Thanks Shah

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Shah Satish wrote:

        I have cstring my text; in stdafx.cpp...

        Why? Stdafx.cpp is not using the variable, so why not just put it in arxmain.cpp?


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        1 Reply Last reply
        0
        • S Shah Satish

          Hi !!! I have two cpp file..like Confwebd.cpp and arxmain.cpp.. I have cstring my text; in Confwebd.cpp now i want to use this string value in arxmain.cpp .. Can any body know how can i make it ?? Thanks Shah

          L Offline
          L Offline
          Laxman Auti
          wrote on last edited by
          #4

          declare your variable into Confwebd.cpp as cstring my_text; declare your variable into arxmain.cpp as extern cstring my_text; Note: you must include Confwebd.cpp into arxmain.cpp so that compilar can locate the variable else you will get a linker error. Knock out 't' from can't, You can if you think you can :cool:

          S 1 Reply Last reply
          0
          • L Laxman Auti

            declare your variable into Confwebd.cpp as cstring my_text; declare your variable into arxmain.cpp as extern cstring my_text; Note: you must include Confwebd.cpp into arxmain.cpp so that compilar can locate the variable else you will get a linker error. Knock out 't' from can't, You can if you think you can :cool:

            S Offline
            S Offline
            Shah Satish
            wrote on last edited by
            #5

            Yeh..I got my solution n i did same like your code.. Thanks

            L 1 Reply Last reply
            0
            • S Shah Satish

              Yeh..I got my solution n i did same like your code.. Thanks

              L Offline
              L Offline
              Laxman Auti
              wrote on last edited by
              #6

              :rose::) Knock out 't' from can't, You can if you think you can :cool:

              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