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. Other Discussions
  3. The Weird and The Wonderful
  4. Another Cause for LNK1181

Another Cause for LNK1181

Scheduled Pinned Locked Moved The Weird and The Wonderful
helpc++databasecomtools
14 Posts 5 Posters 28 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.
  • L Lost User

    Hi, It's already documented. The /P option[^] suppresses compilation. It instructs the compiler to NOT produce an .obj file. That /P compiler option will always cause the linker to fail. Because there was nothing produced that could be linked. The LNK1181 is telling you "object file not found" which is correct. You should always make an attempt to fully understand each and every compiler option you are using. I'd recommend avoiding using compiler options that you do not understand. Best Wishes, -David Delaune

    D Offline
    D Offline
    David A Gray
    wrote on last edited by
    #3

    That's not the point, which is that the documentation would be more helpful if it mentioned that switch as something that will, obviously, elicit LNK1181. I spent a lot of time chasing down other potential causes that I wouldn't have spent if the documentation had mentioned the /P switch. Had it done so, I would immediately have checked for that, since I knew that I had enabled it for that translation unit a few hours earlier. As it is, I was unsurprised that the /P switch was enabled on the module property sheet for that translation unit, and that it overrode the project property sheet that said otherwise. I've been writing in various flavors of the C programming language since 2005, and my reading knowledge goes back a further 20 years. I've worked almost exclusively in the Microsoft stack since the mid 1990's, and have worked in other equally complex stacks since 1978.

    David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

    L M 2 Replies Last reply
    0
    • D David A Gray

      That's not the point, which is that the documentation would be more helpful if it mentioned that switch as something that will, obviously, elicit LNK1181. I spent a lot of time chasing down other potential causes that I wouldn't have spent if the documentation had mentioned the /P switch. Had it done so, I would immediately have checked for that, since I knew that I had enabled it for that translation unit a few hours earlier. As it is, I was unsurprised that the /P switch was enabled on the module property sheet for that translation unit, and that it overrode the project property sheet that said otherwise. I've been writing in various flavors of the C programming language since 2005, and my reading knowledge goes back a further 20 years. I've worked almost exclusively in the Microsoft stack since the mid 1990's, and have worked in other equally complex stacks since 1978.

      David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #4

      Well, Technically... there are several of the compiler options[^] that suppress compilation. The /E[^] and /EP[^] and /P[^] all suppress compilation and always result in a linker failure. There may be a few more as that's all I remember off the top of my head. I do think that it might be useful if these compiler options generated a level 3 or 4 warning so they can be caught by /WX. But if that change was made... you'd hear someone else complaining that they are unable to generate preprocessed output to a file when /W3 or /W4 was enabled. Best Wishes, -David Delaune

      D 1 Reply Last reply
      0
      • L Lost User

        Well, Technically... there are several of the compiler options[^] that suppress compilation. The /E[^] and /EP[^] and /P[^] all suppress compilation and always result in a linker failure. There may be a few more as that's all I remember off the top of my head. I do think that it might be useful if these compiler options generated a level 3 or 4 warning so they can be caught by /WX. But if that change was made... you'd hear someone else complaining that they are unable to generate preprocessed output to a file when /W3 or /W4 was enabled. Best Wishes, -David Delaune

        D Offline
        D Offline
        David A Gray
        wrote on last edited by
        #5

        I agree, and you raise a good point about other switches that suppress code generation. I suspect the best compromise is to call attention to them in the documentation of LNK1181; other linkage editor errors go into such detail about possible causes. Since linkage editor errors can be difficult to solve, all the help that can be mustered would be appreciated by all concerned. Would you be willing to comment on the issue that I opened, so that Microsoft hears from someone besides me in this regard? If so, the URL is in my original message.

        David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

        L 1 Reply Last reply
        0
        • D David A Gray

          I agree, and you raise a good point about other switches that suppress code generation. I suspect the best compromise is to call attention to them in the documentation of LNK1181; other linkage editor errors go into such detail about possible causes. Since linkage editor errors can be difficult to solve, all the help that can be mustered would be appreciated by all concerned. Would you be willing to comment on the issue that I opened, so that Microsoft hears from someone besides me in this regard? If so, the URL is in my original message.

          David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #6

          David A. Gray wrote:

          Would you be willing to comment on the issue that I opened, so that Microsoft hears from someone besides me in this regard?

          Unfortunately I cannot comment on your open issue. Back when I became a Microsoft employee I signed at least a dozen mountains of documents that limit my ability to comment and interact on public forums regarding Microsoft and certain Microsoft products. I've probably crossed or walked that line already within the last few years. Trust me, both the Visual Studio team and c++ compiler team has probably already seen your open issue. Give him some time to respond. Best Wishes, -David Delaune

          D T 2 Replies Last reply
          0
          • L Lost User

            David A. Gray wrote:

            Would you be willing to comment on the issue that I opened, so that Microsoft hears from someone besides me in this regard?

            Unfortunately I cannot comment on your open issue. Back when I became a Microsoft employee I signed at least a dozen mountains of documents that limit my ability to comment and interact on public forums regarding Microsoft and certain Microsoft products. I've probably crossed or walked that line already within the last few years. Trust me, both the Visual Studio team and c++ compiler team has probably already seen your open issue. Give him some time to respond. Best Wishes, -David Delaune

            D Offline
            D Offline
            David A Gray
            wrote on last edited by
            #7

            Thank you for disclosing your connection. Since my immediate problem is resolved, my objective in opening the issue is to pay it forward by suggesting an improvement that I suspect will benefit some future puzzled programmer. Hence, I have no time limit, and I suspected that they might already have seen it, or at least a report thereof.

            David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

            1 Reply Last reply
            0
            • L Lost User

              Hi, It's already documented. The /P option[^] suppresses compilation. It instructs the compiler to NOT produce an .obj file. That /P compiler option will always cause the linker to fail. Because there was nothing produced that could be linked. The LNK1181 is telling you "object file not found" which is correct. You should always make an attempt to fully understand each and every compiler option you are using. I'd recommend avoiding using compiler options that you do not understand. Best Wishes, -David Delaune

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #8

              Why would there be an option to not produce the .obj file? That is, after all, the point of compilation! I guess there might be some reason you don't want the .obj file overwritten, but I can't think of any good reason at the moment.

              Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              L 1 Reply Last reply
              0
              • M Marc Clifton

                Why would there be an option to not produce the .obj file? That is, after all, the point of compilation! I guess there might be some reason you don't want the .obj file overwritten, but I can't think of any good reason at the moment.

                Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #9

                Marc Clifton wrote:

                Why would there be an option to not produce the .obj file?

                Most C/C++ compilers support executing *only* the preprocessor stage before the abstract syntax tree and code generation stages. I typically use it when I need to see how the preprocessor expands my macros. The Microsoft compiler will generate .i files with all of the preprocessor results... macros expanded and included in the file. Both GCC and Clang use the -E switch for accomplishing the same thing. Here is a simple example of why a software developer might want to only run the preprocessor:

                #if DLEVEL > 5
                #define SIGNAL 1
                #if STACKUSE == 1
                #define STACK 200
                #else
                #define STACK 100
                #endif
                #else
                #define SIGNAL 0
                #if STACKUSE == 1
                #define STACK 100
                #else
                #define STACK 50
                #endif
                #endif
                #if DLEVEL == 0
                #define STACK 0
                #elif DLEVEL == 1
                #define STACK 100
                #elif DLEVEL > 5
                #define STACK 50;
                #else
                #define STACK 200
                #endif

                What is the value of STACK? Are you sure? You can expand and debug C macros by running only the preprocessor stage. Can be really useful for complex C macros. Best Wishes, -David Delaune

                D 1 Reply Last reply
                0
                • L Lost User

                  Marc Clifton wrote:

                  Why would there be an option to not produce the .obj file?

                  Most C/C++ compilers support executing *only* the preprocessor stage before the abstract syntax tree and code generation stages. I typically use it when I need to see how the preprocessor expands my macros. The Microsoft compiler will generate .i files with all of the preprocessor results... macros expanded and included in the file. Both GCC and Clang use the -E switch for accomplishing the same thing. Here is a simple example of why a software developer might want to only run the preprocessor:

                  #if DLEVEL > 5
                  #define SIGNAL 1
                  #if STACKUSE == 1
                  #define STACK 200
                  #else
                  #define STACK 100
                  #endif
                  #else
                  #define SIGNAL 0
                  #if STACKUSE == 1
                  #define STACK 100
                  #else
                  #define STACK 50
                  #endif
                  #endif
                  #if DLEVEL == 0
                  #define STACK 0
                  #elif DLEVEL == 1
                  #define STACK 100
                  #elif DLEVEL > 5
                  #define STACK 50;
                  #else
                  #define STACK 200
                  #endif

                  What is the value of STACK? Are you sure? You can expand and debug C macros by running only the preprocessor stage. Can be really useful for complex C macros. Best Wishes, -David Delaune

                  D Offline
                  D Offline
                  David A Gray
                  wrote on last edited by
                  #10

                  Randor wrote:

                  What is the value of STACK? Are you sure? You can expand and debug C macros by running only the preprocessor stage. Can be really useful for complex C macros

                  That is precisely the reason I used the /P switch, as it has been in every case when I did so. The only reason that it created a problem this time is that the build environment left it enabled for the Win32 Release configuration.

                  David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                  1 Reply Last reply
                  0
                  • L Lost User

                    David A. Gray wrote:

                    Would you be willing to comment on the issue that I opened, so that Microsoft hears from someone besides me in this regard?

                    Unfortunately I cannot comment on your open issue. Back when I became a Microsoft employee I signed at least a dozen mountains of documents that limit my ability to comment and interact on public forums regarding Microsoft and certain Microsoft products. I've probably crossed or walked that line already within the last few years. Trust me, both the Visual Studio team and c++ compiler team has probably already seen your open issue. Give him some time to respond. Best Wishes, -David Delaune

                    T Offline
                    T Offline
                    TheGreatAndPowerfulOz
                    wrote on last edited by
                    #11

                    Randor wrote:

                    Visual Studio team and c++ compiler team

                    Randor wrote:

                    him

                    Small "team"

                    #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                    L 1 Reply Last reply
                    0
                    • T TheGreatAndPowerfulOz

                      Randor wrote:

                      Visual Studio team and c++ compiler team

                      Randor wrote:

                      him

                      Small "team"

                      #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #12

                      Hi, I was referring to Colin Robertson[^] who is the owner of the documentation repository. Best Wishes, -David Delaune

                      T 1 Reply Last reply
                      0
                      • L Lost User

                        Hi, I was referring to Colin Robertson[^] who is the owner of the documentation repository. Best Wishes, -David Delaune

                        T Offline
                        T Offline
                        TheGreatAndPowerfulOz
                        wrote on last edited by
                        #13

                        ah

                        #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

                        1 Reply Last reply
                        0
                        • D David A Gray

                          That's not the point, which is that the documentation would be more helpful if it mentioned that switch as something that will, obviously, elicit LNK1181. I spent a lot of time chasing down other potential causes that I wouldn't have spent if the documentation had mentioned the /P switch. Had it done so, I would immediately have checked for that, since I knew that I had enabled it for that translation unit a few hours earlier. As it is, I was unsurprised that the /P switch was enabled on the module property sheet for that translation unit, and that it overrode the project property sheet that said otherwise. I've been writing in various flavors of the C programming language since 2005, and my reading knowledge goes back a further 20 years. I've worked almost exclusively in the Microsoft stack since the mid 1990's, and have worked in other equally complex stacks since 1978.

                          David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                          M Offline
                          M Offline
                          Member_14592279
                          wrote on last edited by
                          #14

                          Thankyou for the valuable information.iam very interested with this one. looking forward for more like this. ac market acmarket apk ac market downloading ac market for android ac market ios ac market for pc

                          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