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#
  4. Can't multiply...

Can't multiply...

Scheduled Pinned Locked Moved C#
question
10 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.
  • O Offline
    O Offline
    o m n i
    wrote on last edited by
    #1

    All the sudden, the compiler is complaining everywhere I've used the * symbol to multiply "The * or -> operator must be applied to a pointer". I don't even have unsafe code enabled so whats going on?

    L L 2 Replies Last reply
    0
    • O o m n i

      All the sudden, the compiler is complaining everywhere I've used the * symbol to multiply "The * or -> operator must be applied to a pointer". I don't even have unsafe code enabled so whats going on?

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

      Omnicoder wrote:

      All the sudden, the compiler is complaining everywhere I've used the * symbol to multiply "The * or -> operator must be applied to a pointer".

      Your expression is wrong; possibly you are trying to multiply a non-numeric value, or an object that does not have an operator* overload. Maybe if you showed a few lines of code to demonstrate the problem we can give a more definitive answer.

      O 1 Reply Last reply
      0
      • L Lost User

        Omnicoder wrote:

        All the sudden, the compiler is complaining everywhere I've used the * symbol to multiply "The * or -> operator must be applied to a pointer".

        Your expression is wrong; possibly you are trying to multiply a non-numeric value, or an object that does not have an operator* overload. Maybe if you showed a few lines of code to demonstrate the problem we can give a more definitive answer.

        O Offline
        O Offline
        o m n i
        wrote on last edited by
        #3

        Even simple things like this break it.

        int num1 = 0;
        int num2 = 7;
        return (num1 * num2);

        L L 2 Replies Last reply
        0
        • O o m n i

          All the sudden, the compiler is complaining everywhere I've used the * symbol to multiply "The * or -> operator must be applied to a pointer". I don't even have unsafe code enabled so whats going on?

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Omnicoder wrote:

          whats going on?

          You probably have a better chance of figuring that out, unless you would have the extravagance of showing the relevant code. An extremely wild guess: somehow you lost an operand or inserted a '*' and now have two consecutive operators (as in a+*b, or a=*c) :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


          O 1 Reply Last reply
          0
          • L Luc Pattyn

            Omnicoder wrote:

            whats going on?

            You probably have a better chance of figuring that out, unless you would have the extravagance of showing the relevant code. An extremely wild guess: somehow you lost an operand or inserted a '*' and now have two consecutive operators (as in a+*b, or a=*c) :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


            O Offline
            O Offline
            o m n i
            wrote on last edited by
            #5

            I posted an example in my reply to the other answerer.

            L 1 Reply Last reply
            0
            • O o m n i

              I posted an example in my reply to the other answerer.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              if your observations are correct, your IDE must be ill. Try closing and reopening it. If need be, try a reboot too. If that doesn't help, give us specifics: which OS, which IDE, and a small but actual code snippet. :)

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


              I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


              O 1 Reply Last reply
              0
              • O o m n i

                Even simple things like this break it.

                int num1 = 0;
                int num2 = 7;
                return (num1 * num2);

                L Offline
                L Offline
                loyal ginger
                wrote on last edited by
                #7

                How about creating a new very simple project with just the above three lines in one function. I am sure it will work. Somewhere in your program * messed up something.

                1 Reply Last reply
                0
                • O o m n i

                  Even simple things like this break it.

                  int num1 = 0;
                  int num2 = 7;
                  return (num1 * num2);

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

                  Assuming that this is an entire project then I guess something is corrupt in your compiler or your system include files, but it's impossible to say what.

                  1 Reply Last reply
                  0
                  • L Luc Pattyn

                    if your observations are correct, your IDE must be ill. Try closing and reopening it. If need be, try a reboot too. If that doesn't help, give us specifics: which OS, which IDE, and a small but actual code snippet. :)

                    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                    I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                    O Offline
                    O Offline
                    o m n i
                    wrote on last edited by
                    #9

                    It seems to be local only to one project, so it must be a setting somewhere...

                    L 1 Reply Last reply
                    0
                    • O o m n i

                      It seems to be local only to one project, so it must be a setting somewhere...

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #10

                      I don't know any setting that would cause that. I suggest you create a new project, move your source files (mainly the *.cs; and not the csproj and other specials) into it, try to build. If that works, delete the files (csproj and specials) you did not copy. :)

                      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                      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