Recibo un error del siguiente código con C++.Función estática declarada pero no definida en C++
Main.cpp
#include "file.h"
int main()
{
int k = GetInteger();
return 0;
}
file.h
static int GetInteger();
File.cpp
#include "file.h"
static int GetInteger()
{
return 1;
}
El error que consigo:
Error C2129: static function 'int GetInteger(void)' declared but not defined.
He leído el famoso artículo "Organizing Code File in C and C++", pero no entienden lo que está mal con este código.
¿Cómo la vincula? "gcc -o Prueba Main.cpp File.cpp -lstdC++" o en algún lugar de XCode/VisualStudio/Eclipse? –
Lo que dijo @ViktorLatypov. Muéstranos cómo lo estás compilando. – Brady
Uso Visual Studio. – Sait