I created a library project and app project.I want to use the sturct variable which declared in library project,but I can't do that.Why?The code shown as below:
Please help me.Thanks!
The library project can be built successfully.Firstly,I declared a structure in library header file and also defined a extern structure variable. Secondly,I defined a function which used this structure variable in library source file. And then I export from library header file and the variable also used in library source file.Then I defined a same structure variable and call that function in app project.But it reported some errors while building.
Hi,
I'm not sure what is your library/project structure. But basically - you need to implement functions in your library code. Structure definition can be done in library header file.
For using your library in your project, you need to tell linker where the library is. Right click on project name -> Properties:
If you specify function/variable as a extern - it tells linker to search such function in other obj files.