Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    LNK2019 Error

    Scheduled Pinned Locked Moved SDK Help
    13 Posts 0 Posters 900 Views
    Loading More Posts
    • 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.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 26/10/2012 at 08:29, xxxxxxxx wrote:

      Exactly.  The "RegisterMyPlugin()" methods are global.  You could include them in a header and include that at the top of your main.cpp file but that would just be a matter of style.  Easier to declare them in your main.cpp before the method that uses them (PluginStart()).

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 27/10/2012 at 00:26, xxxxxxxx wrote:

        Thanks Yannick and Rob,
         
        The below is what's in my main.cpp file. As you can see, I'm trying to start as simply as I can 😃 The error shows with the below as is. Is this incorrect?
         
        #include "c4d.h"
        //-- Forward Declarations:
        Bool RegisterMyPlugin(void);     // ADD PLUGINS HERE
        Bool PluginStart(void)
        {
          if (!RegisterMyPlugin()) return FALSE; *****
          return TRUE;
        }
        void PluginEnd(void)
        {
        }
        Bool PluginMessage(LONG id, void *data)
        {
        return TRUE;
        }
         
        ***** if this line is blanked out, the error doesn't appear. But the plugin won't show in Cinema.
         
        Cheers,
         
        WP.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 27/10/2012 at 03:00, xxxxxxxx wrote:

          You have declared the function RegisterMyPlugin(), but you haven't provided the body of the function. Somewhere in your code, you must actually provide that function. That's why the linker complains, because it can't find the compiled code to include in the plugin.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 29/10/2012 at 16:49, xxxxxxxx wrote:

            Ah, I see what I've done. I had the Class in myplugin.cpp (not main.cpp) file named differently. Took me a bit to work that out. All now shows up and works in 32bit. I'm underway!
            Thanks for your patience folks 😃
             
            WP.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 08/11/2012 at 01:41, xxxxxxxx wrote:

              Hi Folks,
               
              I'm having a bit of an issue with forward declaring a GeUserArea. I'm not sure how to put it in my main dialog class (the userarea is after my dialog class in the code layout)?
               
              I have this in my dialog class' private section:
               
              //MyDialog::MyUserArea;     //didn't work
              void MyUserArea(int){}       //doesn't work
              //MyUserArea MUA;             //gives a compiler error
              C4DGadget *MyGad;           //seems right...
               
              In my dialog group:
               
              MyGad = AddUserArea(DLG_USERAREA, BFH_SCALE|BFV_SCALE);    // seems right...
              AttachUserArea(MyUserArea, MyGad);                                             // whatever goes here gives error
               
              And in MyUserArea class, I've tried variations of the following in the private section:
               
              //&MyDialog::MyUserArea;     // this part was tried because the compiler suggested it in the error list
               
              Just unsure how to call it in the dialog class that's before the userarea class in the coding. I've looked in the SDK's gradient example but the USERAREA class is before the dialog class. I'm wishing to put it in after (the two classes may need to interact at times and thus I will need a forward declaration somewhere). How do I write this correctly in code?
               
              Regards,
               
              WP.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 08/11/2012 at 01:58, xxxxxxxx wrote:

                If MyUserArea is the name of your GeUserArea you just need to forward declare this class before your dialog's class:

                class MyUserArea;
                  
                class MyDialog : public GeDialog
                {
                    private:
                        MyUserArea userArea;
                };
                  
                class MyUserArea : public GeUserArea
                {
                };
                

                But the cleanest way to do this is to declare the user area in another header then include it in the dialog's header.

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 08/11/2012 at 02:24, xxxxxxxx wrote:

                  Thanks Yannick. That was simple!
                   
                  Only thing now is I'm getting another error 😃 Using your code as example, it's giving error 1 as 'MyDialog::userArea' uses undefined class 'MyUserArea' and it's referencing the line "MyUserArea userArea;" in the dialog class' private section.
                   
                  There is a second error, but this might fix itself if the first one is fixed. Error: MyDialog::AttachUserArea : cannot convert parameter 1 from 'int' to 'GeUserArea &'
                   
                  WP.

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 08/11/2012 at 02:51, xxxxxxxx wrote:

                    The solution I gave you doesn't work because forward declaration of a class only works if we would declare the user area as a pointer member.
                    I think the best solution is to define the user area before the dialog's class using it or even better and cleaner, declare it in another header.

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 08/11/2012 at 03:13, xxxxxxxx wrote:

                      Thanks Yannick,
                       
                      the c++ reasoning is a little over my head 😃 but I've now moved the userarea to before the Dialog class as you've suggested. So it's now showing in my dialog (though it disappears when I resize the dialog - something for me to look further into there).
                       
                      I can see a good reason for moving it to it's own header (if anything just for ease of editing etc). But just wanting to keep things to the one file for the moment as it's a fairly simple dialog! I'll probably have to do this if/when things get a little more "code heavy" though.
                       
                      Thanks again!
                       
                      WP.

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 09/11/2012 at 04:16, xxxxxxxx wrote:

                        Hi Folks,
                         
                        me again!
                         
                        My userarea isn't refreshing properly. It's only redrawing when the dialog is maximised. But when scaling manually it sometimes leaves other 'things' in the userarea (like ghost images of the bitmap I have in it). Userarea class code below:
                         
                          virtual void DrawMsg(LONG x1,LONG y1,LONG x2,LONG y2, const BaseContainer &msg)
                          {
                           OffScreenOn();
                        SetClippingRegion(x1,y1,x2,y2);
                          
                        Area_Width = this->GetWidth();
                        Area_Height = this->GetHeight();
                        Area_Center_Width = Area_Width/2;
                        Area_Center_Height = Area_Height/2;
                           AutoAlloc<BaseBitmap> bmp;
                        Filename Cr = GeGetPluginPath() + Filename("TestImage.png");
                        bmp->Init(Cr,-1,NULL);
                            DrawBitmap(bmp, Area_Center_Width-135, Area_Center_Height-225, 270, 370, 0, 0, 270, 370, BMP_NORMAL|BMP_ALLOWALPHA);
                          }
                         
                        The bitmap I have displays fine, but as mentioned if the dialog is manually resized it's not refreshing properly. I found a similar thread on this from a few years a go, but I wasn't able to decipher an outcome from it. I also tried the ReDraw() but wasn't able to get that to do anything either. Redraw below:
                         
                          void ReDraw(Bool threaded = FALSE)
                          {
                        this->Redraw();    // tried a few variations of this
                          } 
                         
                        Is there a msg/command/something of the like I'm missing?
                         
                        WP.

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 11/11/2012 at 01:18, xxxxxxxx wrote:

                          Alrighty, I ended up drawing a rectangle to fill the UA, which seems to have solved the ghosting and redraw issues etc. Though if it's possible to do this without the rectangle (or a faster way in terms of processing) I'd still be interested in hearing.
                           
                          Cheers,
                           
                          WP.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post