James-
July 27th, 2009, 06:27 PM
I'm currently using code::blocks (I'm coding on Linux, obviously :P) when I go to compile my program I get the fallowing error:
~/codeblocks/readconfig/readconfig.h|25|error: 'std::string ReadConfig::ReadConfParameter(char*)' used but never defined|
||=== Build finished: 1 errors, 0 warnings ===|
and if I remove static I get that I have an undefined reference to 'ReadConfige:;readConfParameter(char*)'
readconfig.h
#ifndef READCONFIG_H_INCLUDED
#define READCONFIG_H_INCLUDED
//.......[skip defines]
namespace ReadConfig
{
static std::string ReadConfParameter(char* ConfigParam); //Line 25
}
#endif // READCONFIG_H_INCLUDED
main.cpp
#include <iostream>
#include <cstdio>
#include <string>
#include "readconfig.h"
using namespace std;
int main()
{
ReadConfig::ReadConfParameter(conf_STANDBY);
return 0;
}
readconfig.cpp
#include "readconfig.h"
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
std::string ReadConfParameter(char* ConfigParam)
{
//do stuff
}
~/codeblocks/readconfig/readconfig.h|25|error: 'std::string ReadConfig::ReadConfParameter(char*)' used but never defined|
||=== Build finished: 1 errors, 0 warnings ===|
and if I remove static I get that I have an undefined reference to 'ReadConfige:;readConfParameter(char*)'
readconfig.h
#ifndef READCONFIG_H_INCLUDED
#define READCONFIG_H_INCLUDED
//.......[skip defines]
namespace ReadConfig
{
static std::string ReadConfParameter(char* ConfigParam); //Line 25
}
#endif // READCONFIG_H_INCLUDED
main.cpp
#include <iostream>
#include <cstdio>
#include <string>
#include "readconfig.h"
using namespace std;
int main()
{
ReadConfig::ReadConfParameter(conf_STANDBY);
return 0;
}
readconfig.cpp
#include "readconfig.h"
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
std::string ReadConfParameter(char* ConfigParam)
{
//do stuff
}