I am implementing a Ring Buffer construct in C++ in the course of a workshop we are going through. Now, the source code may be okay, but the linker just won't work properly - or more likely my code or project settings.
Header: http://pastie.org/private/rbx84gvlzc9ipzk1mzczg
Source: http://pastie.org/private/kkjjhwywfljgnw75jlmxsq
The build process says:
1>------ Build started: Project: RingBuffer, Configuration: Debug Win32 ------ 1> RingBuffer.cpp 1>RingBuffer.obj : error LNK2019: unresolved external symbol "public: __thiscall RingBuffer::RingBuffer(int)" (??0RingBuffer@@QAE@H@Z) referenced in function _main 1>C:\Users*.*\Documents\Visual Studio 2013\Projects\RingBuffer\Debug\RingBuffer.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks in advice for any helpful suggestions.
You have not defined the constructor
RingBuffer(int storageAmount);
You gave definition of
RingBuffer();
But using the previous one in main
.
This is clear from the error message
unresolved external symbol public: __thiscall RingBuffer::RingBuffer(int)
Linker can not find the method to link.