1 year ago
#342523
Alexander
How to resolve linker when when using multiple files in Virtual-C?
This post can be closed, since someone gave an answer to my problem in the comments below. The linked solution however has nothing to do with the problem and should be removed.
I am trying to build a project containing two .c
files and a header file in the Virtual-C integrated IDE and compiler.
No matter what I try, where I save the files or what I change, I always get the following error message:
linker: can't find the symbol _testReturn as requested in _main
My build options are shown below, which seem to indicate that Virtual-C is linking test.c
and hence the definition of testReturn
should be visible to the linker. What am I missing?
test.h:
#ifndef TEST_H
#define TEST_H
int testReturn(int a);
#endif
test.c:
#include <test.h>
int testReturn(int a) {
return a;
}
main.c:
#include <stdio.h>
#include <test.h>
int main(void) {
int a = testReturn(2);
printf("%d", a);
return 0;
}
c
build-system
ansi-c
0 Answers
Your Answer