I have mylib.lib:
//mylib.h:
int foo();
//mylib.cpp:
#include "mylib.h"
const int arr[] = {1, 2};
int foo() {
return arr[0];
}
And proxylib.lib:
//proxylib.h:
int bla1();
int bla2();
//proxylib.cpp:
#include "../mylib/mylib.h"
#include "proxylib.h"
int bla1() {
return 2;
}
int bla2() {
return foo();
}
and the exe project:
//main.cpp
#include "../proxylib/proxylib.h"
#include <iostream>
int main() {
std::cout << bla1();
return 0;
}
The main project has reference to proxylib.lib project, and proxylib project has reference to mylib.lib project. After compiling and linking the project to the final exe, I got the unused global variable "arr" from mylib.lib in the exe even though the function "foo" isn't in the exe. WHY ?
Thanks !