So I made simple static library LogCon with such code in LogCon.cpp:
#include "LogCon.h"
namespace LogCon
{
static bool NOT(bool a)
{
return !a;
}
}
and LogCon.h:
namespace LogCon
{
class MyLogCon
{
public:
static bool NOT(bool a);
};
}
It was compiled fine, so I decided to make console app for this MyLogCon.cpp:
#include "LogCon.h"
#include <iostream>
using namespace std;
int main()
{
bool a=true;
cout << LogCon::MyLogCon::NOT(a);
return 0;
}
Previously added and linked this library to the project, set main console app as StartUp project. Tried to compile everything but got this:
2>MyLogCon.obj : error LNK2019: unresolved external symbol "public: static bool __cdecl LogCon::MyLogCon::NOT(bool)" (?NOT@MyLogCon@LogCon@@SA_N_N@Z) referenced in function _main
2>C:\DM\LogCon\Debug\MyLogCon.exe : fatal error LNK1120: 1 unresolved externals
I found a couple questions where was almost the same problem at stackoverflow but no one answer has helped me, so I just don't know what actually happened, please show me problem in the code why I got this error..