Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

VS6 linker problem c/c++ mixed app


  • Please log in to reply

#1
codeguru

codeguru

    New Member

  • Member
  • Pip
  • 1 posts
Hi! I have an obscure problem with an app that was completely written in C. Now I had to add some c++ functions, and I get a linker error when in my file (that belongs to my project) a struct is added. In this struct are some function adresses used in this file. Two of the elements are declared in different header files, and these cause a linker problem.

The definition of the struct is:

struct DummycppGrabber
{
struct LowLevelGrabber g;//defined elsewhere
int grab_x0, grab_y0, grab_xsize, grab_ysize;
double grab_gain, grab_offset;
long picnum;
int camera;
int framescnt;
};

somewwhere in this file the function NameToVal() is used, the corresponding header file is also included

At the end of the file occur this:

struct DummycppGrabber DummycppGrabberFuncs =
{
{
{
/* type */ HW_LLGRABBER,
/* name */ "DummycppGrabber",
/* size */ sizeof(struct DummycppGrabber),
/* ParamSet */ DummycppParamSet,
/* ParamGet */ DummycppParamGet,
/* Init */ DummycppInit,
/* Close */ DummycppClose
},
/* InfoText */ NULL,
/* GetMaxGain */ NULL,
/* GetMaxOffset */ NULL,
/* GetGain */ NULL,
/* GetOffset */ NULL,
/* SetGain */ NULL,
/* SetOffset */ NULL,
/* GetPixelsize */ NULL,
/* GetMaxROI */ NULL,
/* GetROI */ NULL,
/* GetROIsize */ NULL,
/* SetROI */ NULL,
/* GetMaxGrabs */ NULL,
/* GetNumGrabs */ NULL,
/* LiveOut */ NULL,
/* Grab2Obj */ NULL,
/* Grab2Buf */ NULL,
/* Grab */ DummycppGrab,
/* GetGrab2Obj */ NULL,
/* ChopGrab */ NULL,
/* GetGrab2ByteBuf */ DummycppGetGrab2ByteBuf,
/* GetGrab2UshortBuf*/ DummycppGetGrab2UshortBuf,
/* GetLine2ByteBuf */ DummycppGetLine2ByteBuf,
/* GetLine2UshortBuf */ DummycppGetLine2UshortBuf,
/* PutGrabNrFromByteBuf */NULL,
/* ALU */ NULL,
/* WaitGrabDone */ DummycppWaitGrabDone,
/* GetLine2UlongBuf */ NULL,
/* GetGrab2UlongBuf */ NULL,
/* GetGrab2DoubleBuf */ NULL,
/* GetLine2DoubleBuf */ NULL,
}
};

I get this error:

dummy.obj : error LNK2001: Nichtaufgeloestes externes Symbol "int __cdecl NameToVal(char const * const * const,int const * const,int,char const *,int)" (?NameToVal@@YAHQBQBDQBHHPBDH@Z)
mcpp.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise

The meaning is: not resolved external symbol "int ....."

If I exclude this struct the linker works correctly. If I change the struct declaration to the c++ style (removing the struct statement) I get the same error. Maybe the error is obvious but I'm not too familar with c++
  • 0

Advertisements


#2
inoxx.net

inoxx.net

    Member

  • Member
  • PipPip
  • 16 posts
That usually means it is being defined twice...
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP