LNK2019 Error
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/10/2012 at 04:03, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;---------
Hi folks,
the serial pest is at it again!
I'm getting the following error:
Error 1 error LNK2019: unresolved external symbol "int __cdecl RegisterMyPlugin(void)" (?RegisterMyPlugin@@YAHXZ) referenced in function "int __cdecl PluginStart(void)" (?PluginStart@@YAHXZ) C:\Program Files\MAXON\CINEMA 4D R14\plugins\MyPlugin\main.objI've been Googling for a few days but can't find anything of help. What do I need to fix this issue here?
Regards,
WP. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/10/2012 at 05:00, xxxxxxxx wrote:
Hi,
You get this link error because you have to forward declare RegisterMyPlugin() at the beginning of the main.cpp.
-
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()).
-
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. -
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.
-
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. -
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. -
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.
-
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. -
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. -
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. -
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. -
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.