Avatar of panJames
panJames

asked on 

Trying to use simple function in Windows Form application

Hello experts.

Created simple windows form application in VC++ 2008.

Please have a look at the code below:

private: System::Void listBox1_Click(System::Object^  sender, System::EventArgs^  e)
                   {
                         String^ s;

                         if ( listBox1->SelectedIndex != -1 )
                              s = listBox1->SelectedItems[0]->ToString();

                         aaa(1);
   
                         
                         

                   }
      };


As you can see, I try to call "aaa(1)".


My "Headers.h":

#include "stdafx.h"

int aaa(int a);



My "Functions.cpp":

#include "stdafx.h"

int aaa(int a)
{
      return -1;
      
}




But get two errors:

OpenCV tester.obj : error LNK2028: unresolved token (0A00000A) "int __clrcall OpenCVtester::aaa(int)" (?aaa@OpenCVtester@@$$FYMHH@Z) referenced in function "private: void __clrcall OpenCVtester::Form1::listBox1_Click(class System::Object ^,class System::EventArgs ^)" (?listBox1_Click@Form1@OpenCVtester@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
OpenCV tester.obj : error LNK2019: unresolved external symbol "int __clrcall OpenCVtester::aaa(int)" (?aaa@OpenCVtester@@$$FYMHH@Z) referenced in function "private: void __clrcall OpenCVtester::Form1::listBox1_Click(class System::Object ^,class System::EventArgs ^)" (?listBox1_Click@Form1@OpenCVtester@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)

Why is that?



Thank you

panJames
C

Avatar of undefined
Last Comment
Subrat (C++ windows/Linux)

8/22/2022 - Mon