Unresolved Externals Error when calling function from onClick lamdba

Hi, I am a beginner trying to call a function that changes a variable using Button.onClick. The variable value should be able to be read in other functions. When I use this code here I get the error "LNK2019: unresolved external symbol “void __cdecl instrumentMenu(void)” (?instrumentMenu@@YAXXZ) referenced in function “public: __cdecl <lambda_9b45ac06c69a8345ca6672a7847f3ed4>::operator()(void)const”
I also get this error for the exitMenu() as well. How could I fix this error, or is there a better way to do this?

#include "PluginProcessor.h"
#include "PluginEditor.h"
#include <iostream>
#include <string>
using namespace std;

string currentPage = "Home";
    void instrumentMenu(); 
    {
        currentPage = "Instrument";
    };
    void exitMenu();
    {
        currentPage = "Exit";
    };
    insButton.onClick = [this]() {instrumentMenu(); };
    exitButton.onClick = [this]() {exitMenu(); };

You’ve put a semi-colon after the function prototype :slight_smile: It should be:

    void instrumentMenu()  // no semi-colon here!
    {
        currentPage = "Instrument";
    };

Because of this semi-colon, your compiler reads the prototype but ignores the implementation between the curly brackets. Then your linker complains that it can’t find the implementation.