Foros del Web » Programación para mayores de 30 ;) » Programación General »

error LNK2001: unresolved external symbol _myvar

Estas en el tema de error LNK2001: unresolved external symbol _myvar en el foro de Programación General en Foros del Web. 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) ...
  #1 (permalink)  
Antiguo 01/04/2004, 14:55
 
Fecha de Ingreso: marzo-2004
Mensajes: 96
Antigüedad: 20 años, 1 mes
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
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:39.