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. command line arguement for Win32

command line arguement for Win32

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

    Sir, I have developed an application using Win32. Inside main(){ .. } I have created a server socket and waiting to accept to connect. How should I create an exe fom the command line. It takes WS2_32.lib AS a parameter to give an exe. Pls guide what can be command line parameters so that it can combine with the lib file to create exe..

    V N 2 Replies Last reply
    0
    • U User 1149186

      Sir, I have developed an application using Win32. Inside main(){ .. } I have created a server socket and waiting to accept to connect. How should I create an exe fom the command line. It takes WS2_32.lib AS a parameter to give an exe. Pls guide what can be command line parameters so that it can combine with the lib file to create exe..

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      You cannot link a library to an executable at runtime. How do you expect to compile the winsock library at runtime? Kuphryn

      U D 2 Replies Last reply
      0
      • U User 1149186

        Sir, I have developed an application using Win32. Inside main(){ .. } I have created a server socket and waiting to accept to connect. How should I create an exe fom the command line. It takes WS2_32.lib AS a parameter to give an exe. Pls guide what can be command line parameters so that it can combine with the lib file to create exe..

        N Offline
        N Offline
        Nirav Doshi
        wrote on last edited by
        #3

        I think you can just give a #pragma directive like:

        #pragma comment (lib, "ws2_32")
        

        in your source code (It can be a common header file, like stdafx.h, if you're using MFC!) With this directive, you will NOT require any command line parameters, or even to include the LIB/DLL file in your project settings. The compiler will pick up the LIB file and use it while compiling. * Don't wish it was easier, wish you were better! *

        1 Reply Last reply
        0
        • V valikac

          You cannot link a library to an executable at runtime. How do you expect to compile the winsock library at runtime? Kuphryn

          U Offline
          U Offline
          User 1149186
          wrote on last edited by
          #4

          my aim is ti likn the object file and the lib file to create the exe. How should I go about this

          1 Reply Last reply
          0
          • V valikac

            You cannot link a library to an executable at runtime. How do you expect to compile the winsock library at runtime? Kuphryn

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

            kuphryn wrote: You cannot link a library to an executable at runtime. Sure you can. It's called explicit linking.


            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

            V 1 Reply Last reply
            0
            • D David Crow

              kuphryn wrote: You cannot link a library to an executable at runtime. Sure you can. It's called explicit linking.


              "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

              V Offline
              V Offline
              valikac
              wrote on last edited by
              #6

              Correct. Explicit linking works for DLL. How about library? Kuphryn

              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