Hierarchy
\Folder1
cpu.h
cpu.c
sources
\Folder2
mem.h
mem.c
sources
dirs
cpu.h
...
#define nope 0
...
int chuckTesta(unsigned int a);
....
cpu.c
#include <cpu.h>
int chuckTesta(unsigned int a){ ... }
mem.c
#include <cpu.h> // A
extern int chuckTesta(unsigned int a); // B
cout << nope << endl; // C
cout << chuckTesta(1); // D
Is there a way to link cpu.lib to the files within Folder2 and satisfy these requirements?
- Remove line A
- Line C and D still work
- Compiles and links with no warnings (right now I’m either getting unresolved external symbol, or definition errors)
Note: Folder2’s sources file only compiles the files within Folder2, and has Folder1 as an include path. Similarly with Folder1. Each create a .lib file, cpu.lib and mem.lib respectively.
I’m using LINK, CL, and building for Windows8.
The problem with removing line A is
#define nope 0. If you convert the define to a static integer (or add one) in cpu.lib it should work. Just make sure you link to both cpu.lib and mem.lib in the final executable.cpu.h
mem.c