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. CString and console app.

CString and console app.

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

    I get linker errors when I try to do this, do I have to use a #pragma or something?

    #include <iostream.h>
    #include <afx.h>

    int main()
    {
    CString c;

    return 0;
    

    }

    Error: --------------------Configuration: test - Win32 Debug-------------------- Linking... nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex Debug/test.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. test.exe - 3 error(s), 0 warning(s) Nick Parker
    May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


    B 1 Reply Last reply
    0
    • N Nick Parker

      I get linker errors when I try to do this, do I have to use a #pragma or something?

      #include <iostream.h>
      #include <afx.h>

      int main()
      {
      CString c;

      return 0;
      

      }

      Error: --------------------Configuration: test - Win32 Debug-------------------- Linking... nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex Debug/test.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. test.exe - 3 error(s), 0 warning(s) Nick Parker
      May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


      B Offline
      B Offline
      Boogie
      wrote on last edited by
      #2

      If you are using MS Visual Studio, go change your project setting to "Use MFC in a Shared DLL."

      N 1 Reply Last reply
      0
      • B Boogie

        If you are using MS Visual Studio, go change your project setting to "Use MFC in a Shared DLL."

        N Offline
        N Offline
        Nick Parker
        wrote on last edited by
        #3

        Boogie wrote: If you are using MS Visual Studio, go change your project setting to "Use MFC in a Shared DLL." Ah, that works fine, but is there a way to do this directly in code alone so the setting is still listed as "Not Using MFC"? Thanks for the response by the way. :) Nick Parker
        May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


        B 1 Reply Last reply
        0
        • N Nick Parker

          Boogie wrote: If you are using MS Visual Studio, go change your project setting to "Use MFC in a Shared DLL." Ah, that works fine, but is there a way to do this directly in code alone so the setting is still listed as "Not Using MFC"? Thanks for the response by the way. :) Nick Parker
          May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


          B Offline
          B Offline
          Boogie
          wrote on last edited by
          #4

          I am not sure about that. CString is a MFC class. That's the reason I ask you to change the project setting. Your other option is to use char type. Maybe someone else can help you. ;)

          N 1 Reply Last reply
          0
          • B Boogie

            I am not sure about that. CString is a MFC class. That's the reason I ask you to change the project setting. Your other option is to use char type. Maybe someone else can help you. ;)

            N Offline
            N Offline
            Nick Parker
            wrote on last edited by
            #5

            Boogie wrote: Your other option is to use char type. I know I can use other data types to do this, however I wanted to do this specifically with a CString. Thanks for the input. :) Nick Parker
            May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


            J 1 Reply Last reply
            0
            • N Nick Parker

              Boogie wrote: Your other option is to use char type. I know I can use other data types to do this, however I wanted to do this specifically with a CString. Thanks for the input. :) Nick Parker
              May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


              J Offline
              J Offline
              James Spibey
              wrote on last edited by
              #6

              If you want to use CString but not MFC, I use the excellent CStdString[^] class which is an exact clone of CString but using stl. Cheers James

              N 1 Reply Last reply
              0
              • J James Spibey

                If you want to use CString but not MFC, I use the excellent CStdString[^] class which is an exact clone of CString but using stl. Cheers James

                N Offline
                N Offline
                Nick Parker
                wrote on last edited by
                #7

                James Spibey wrote: which is an exact clone of CString but using stl. Thanks James, I will take a look at it today. :) Nick Parker
                May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


                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