Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/04/2004, 14:55
Davinia
 
Fecha de Ingreso: marzo-2004
Mensajes: 96
Antigüedad: 20 años, 2 meses
Puntos: 0
error LNK2001: unresolved external symbol _myvar

Hola,
tengo un problema, me podeis ayudar?


Gracias por adelantado.

//mimain.cpp
#include <stdlib.h>

extern "C"{
#include "mv_example.h"
}

int main()
{
if (myvar == NULL)
myfunction(myvar);
return 1;
}


//m_example.c

#include "mv_example.h"

int myfunction(MY_STRUCT *var)
{
int a;
a=2;
return a;
}

//m_example.h

#ifndef M_EXAMPLE_H
#define M_EXAMPLE_H
typedef struct my_struct
{
int a;
int b;
} MY_STRUCT;

#endif

//mv_example.h

#include "m_example.h"

#ifdef M_MODULE_EXAMPLE

MY_STRUCT *myvar = NULL;

int myfunction(MY_STRUCT *myvar);
#else

extern MY_STRUCT *myvar;
extern int myfunction(MY_STRUCT *myvar);
#endif