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. Managed C++/CLI
  4. How to include or Add Referance with VC++ 2005?

How to include or Add Referance with VC++ 2005?

Scheduled Pinned Locked Moved Managed C++/CLI
questioncsharpc++tutorial
10 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.
  • A Offline
    A Offline
    ALQallaf
    wrote on last edited by
    #1

    Hello im working with MSMQ , so i want to make dll that will send to MSMQ, so how can i include MSMQ Library (System.Messaging.dll) in VC++ ? C:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll thanks

    M 1 Reply Last reply
    0
    • A ALQallaf

      Hello im working with MSMQ , so i want to make dll that will send to MSMQ, so how can i include MSMQ Library (System.Messaging.dll) in VC++ ? C:\WINNT\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll thanks

      M Offline
      M Offline
      Milton Karimbekallil
      wrote on last edited by
      #2

      you can use #using directive to include the managed dlls into your code. Then use the namespace declaration and create the class instance. See the sample below. #using <system.messaging.dll> using namespace System::Messaging; if ( !MessageQueue::Exists( queuePath ) ) MessageQueue::Create( queuePath ); cheers..milton

      A 2 Replies Last reply
      0
      • M Milton Karimbekallil

        you can use #using directive to include the managed dlls into your code. Then use the namespace declaration and create the class instance. See the sample below. #using <system.messaging.dll> using namespace System::Messaging; if ( !MessageQueue::Exists( queuePath ) ) MessageQueue::Create( queuePath ); cheers..milton

        A Offline
        A Offline
        ALQallaf
        wrote on last edited by
        #3

        thank you i tryed it but it give me this error: Error 1 fatal error C1190: managed targeted code requires a '/clr' option can you know how to resolve it ?

        1 Reply Last reply
        0
        • M Milton Karimbekallil

          you can use #using directive to include the managed dlls into your code. Then use the namespace declaration and create the class instance. See the sample below. #using <system.messaging.dll> using namespace System::Messaging; if ( !MessageQueue::Exists( queuePath ) ) MessageQueue::Create( queuePath ); cheers..milton

          A Offline
          A Offline
          ALQallaf
          wrote on last edited by
          #4

          Project Properties -> configuration Properties -> General -> Common Language runtime support set-->Common Language Runtime Support (/clr) but also it gives me this error: :doh: Error 1 Command line error D8016 : '/MTd' and '/clr' command-line options are incompatible cl how can i fix it please ?

          M 1 Reply Last reply
          0
          • A ALQallaf

            Project Properties -> configuration Properties -> General -> Common Language runtime support set-->Common Language Runtime Support (/clr) but also it gives me this error: :doh: Error 1 Command line error D8016 : '/MTd' and '/clr' command-line options are incompatible cl how can i fix it please ?

            M Offline
            M Offline
            Milton Karimbekallil
            wrote on last edited by
            #5

            Error 1 Command line error D8016 : '/MTd' and '/clr' command-line options are incompatible '/MTD' is the Multithreded C Runtime debug version. That means you chose an unmanaged project type. What kind of project you are working on ? If you need to call .net libaries from an unmanaged type, best way is to wrap all ur bussiness rules into an assembly and use CCW - Com callable wrapper to invoke the wrapper .net component from ur unmanaged app. Or else change the project type to a managed. rgds...milton.

            A 1 Reply Last reply
            0
            • M Milton Karimbekallil

              Error 1 Command line error D8016 : '/MTd' and '/clr' command-line options are incompatible '/MTD' is the Multithreded C Runtime debug version. That means you chose an unmanaged project type. What kind of project you are working on ? If you need to call .net libaries from an unmanaged type, best way is to wrap all ur bussiness rules into an assembly and use CCW - Com callable wrapper to invoke the wrapper .net component from ur unmanaged app. Or else change the project type to a managed. rgds...milton.

              A Offline
              A Offline
              ALQallaf
              wrote on last edited by
              #6

              actually i created my project with VC6++, the Convert and open project with VC2005, emm ok i will try to open new fresh project from 2005 directly , so i have to open managed dll project from vc2005. can you tell me which option when i want to create project give me managed dll ? currently i make win32 project--->dll with puting sign on Export symbols only. is im in right way ? -- modified at 17:42 Saturday 6th May, 2006

              A 1 Reply Last reply
              0
              • A ALQallaf

                actually i created my project with VC6++, the Convert and open project with VC2005, emm ok i will try to open new fresh project from 2005 directly , so i have to open managed dll project from vc2005. can you tell me which option when i want to create project give me managed dll ? currently i make win32 project--->dll with puting sign on Export symbols only. is im in right way ? -- modified at 17:42 Saturday 6th May, 2006

                A Offline
                A Offline
                ALQallaf
                wrote on last edited by
                #7

                i think yes im in safe side :-D, now i can compile with no errors after set Common Language Runtime Support (/clr), i want to know if there is any changes between dll on vc6++ and vc2005, everytime i call function within dll by using this declaration int _stdcall SendToQueue(char * SBody,char * SLabel) { return 123; } and i have to make .def file and write exported function header inside it so it will work with vc2005 or there is problem with it ?

                M 1 Reply Last reply
                0
                • A ALQallaf

                  i think yes im in safe side :-D, now i can compile with no errors after set Common Language Runtime Support (/clr), i want to know if there is any changes between dll on vc6++ and vc2005, everytime i call function within dll by using this declaration int _stdcall SendToQueue(char * SBody,char * SLabel) { return 123; } and i have to make .def file and write exported function header inside it so it will work with vc2005 or there is problem with it ?

                  M Offline
                  M Offline
                  Milton Karimbekallil
                  wrote on last edited by
                  #8

                  You were in the wrong side. you again choose an unmanaged project type because win32 project is an unmanged type. After all what you need is to call MSMQ APIs right? You can do it in two ways: 1) Either use unmanaged MSMQ Apis 2) Or use Managed .Net class libraries, which is the one you chose. For the first option: you can go for an unmanaged project type. ie it can be a vc++6 project or a VC++8 MFC application. Then for accessing the MSMQ apis go thru http://www.thecodeproject.com/w2k/msmq.asp. This method will be fater as MSMQ apis are unmanged and you are directly dealing with the apis. Second option is to use managed dlls: This is the option you chose, by using System.Messaging.dll. This is not that good as the previous one as it wrapes the actual MSMQ COM Apis under the hood. If you want to go for this option yu can do it in the following ways: a)Use an Unmanaged VC++ app and use interop for calling the wrapper u created on managed System.Messaging.dll. For this you have to create one managed wrapper dll (New project --> Visual C++ -->CLR --> Class library) and wrap all your msmq requirements using System.Messaging.dll functions.Then use COM iterop to use this managed wrapper dll from ur Unmanaged VC++8 application. (Or you can avoid wrapper dll by using CorBindToRuntimeEx(), but more complicated. better dont go for this if u r beginner). b)USe a Managed VC++ application (New project --> Visual C++ -->CLR --> Windows forms applicaion / Class library). This is a c++/cli application. This will be the easiest methed if you are planning to use System.Messaging.dll (in C++) instaed of the MSMQ COM apis. Or another choice is, you really want to go for vc++? if you go for C# and System.Messaging.dll then it will be the easiest of all. more questions are welcome ...milton

                  A 1 Reply Last reply
                  0
                  • M Milton Karimbekallil

                    You were in the wrong side. you again choose an unmanaged project type because win32 project is an unmanged type. After all what you need is to call MSMQ APIs right? You can do it in two ways: 1) Either use unmanaged MSMQ Apis 2) Or use Managed .Net class libraries, which is the one you chose. For the first option: you can go for an unmanaged project type. ie it can be a vc++6 project or a VC++8 MFC application. Then for accessing the MSMQ apis go thru http://www.thecodeproject.com/w2k/msmq.asp. This method will be fater as MSMQ apis are unmanged and you are directly dealing with the apis. Second option is to use managed dlls: This is the option you chose, by using System.Messaging.dll. This is not that good as the previous one as it wrapes the actual MSMQ COM Apis under the hood. If you want to go for this option yu can do it in the following ways: a)Use an Unmanaged VC++ app and use interop for calling the wrapper u created on managed System.Messaging.dll. For this you have to create one managed wrapper dll (New project --> Visual C++ -->CLR --> Class library) and wrap all your msmq requirements using System.Messaging.dll functions.Then use COM iterop to use this managed wrapper dll from ur Unmanaged VC++8 application. (Or you can avoid wrapper dll by using CorBindToRuntimeEx(), but more complicated. better dont go for this if u r beginner). b)USe a Managed VC++ application (New project --> Visual C++ -->CLR --> Windows forms applicaion / Class library). This is a c++/cli application. This will be the easiest methed if you are planning to use System.Messaging.dll (in C++) instaed of the MSMQ COM apis. Or another choice is, you really want to go for vc++? if you go for C# and System.Messaging.dll then it will be the easiest of all. more questions are welcome ...milton

                    A Offline
                    A Offline
                    ALQallaf
                    wrote on last edited by
                    #9

                    i think it works with option : b)USe a Managed VC++ application (New project --> Visual C++ -->CLR --> Windows forms applicaion / Class library). This is a c++/cli application. This will be the easiest methed if you are planning to use System.Messaging.dll (in C++) instaed of the MSMQ COM apis. -------- Thank you Milton finally its works :-D

                    M 1 Reply Last reply
                    0
                    • A ALQallaf

                      i think it works with option : b)USe a Managed VC++ application (New project --> Visual C++ -->CLR --> Windows forms applicaion / Class library). This is a c++/cli application. This will be the easiest methed if you are planning to use System.Messaging.dll (in C++) instaed of the MSMQ COM apis. -------- Thank you Milton finally its works :-D

                      M Offline
                      M Offline
                      Milton Karimbekallil
                      wrote on last edited by
                      #10

                      had gone for a short hiking to Wachusett Mountain MA. Just back now. sorry for abt the delay buddy. Be aware that the option u selected is managed c++ (c++/cli) app and not a typical vc6++ like unmanaged application. cheers..milton.

                      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