Undefined reference error in gcc
I can compile successfully on several files if I did it separately.
However, when I tried to combine the object files, the compiler shows
error of undefined reference to a couple of names.
I am using g++ -c to produce the object file. The codes are look like this :
main.cpp:
#include "BApp.h"
CBApp* g_pApp;
int main( int argc, char** argv)
{
log2flash("Started version %s", CApp::GetVersion());
g_pApp = new CBApp;
if ( !g_pApp->Init() )
{
delete g_pApp ;
return EXIT_FAILURE ;
}
g_pApp->Run();
g_pApp->Close();
delete g_pApp ;
return EXIT_SUCCESS ;
}
BApp.h:
#include "Shared/app.h"
#include "../typedef.h"
#include "../porting.h"
#ifndef VERSION
#define VERSION "not defined"
No comments:
Post a Comment