大神,关于.h中定义函数,多种实现有关问题
求助大神,关于.h中定义函数,多种实现问题
各大神请看:
//a.h定义一函数
int func(int)
//b.c实现
#include "a.h"
int func(int a)
{
return a+1;
}
//c.c实现
#include "a.h"
int func(int a)
{
return a+2;
}
//main.c
#include "a.h"
int main()
{
func(5);//调用func函数
}
此时编译通过,运行链接不通过。请问有没有办法指定main调用的来自b.c(或者c.c)func()函数??????????
------解决方案--------------------
------解决方案--------------------
不要然lz吧func函数放到两个不同的dll中吧,C中动态载入不同的dll
各大神请看:
//a.h定义一函数
int func(int)
//b.c实现
#include "a.h"
int func(int a)
{
return a+1;
}
//c.c实现
#include "a.h"
int func(int a)
{
return a+2;
}
//main.c
#include "a.h"
int main()
{
func(5);//调用func函数
}
此时编译通过,运行链接不通过。请问有没有办法指定main调用的来自b.c(或者c.c)func()函数??????????
------解决方案--------------------
------解决方案--------------------
不要然lz吧func函数放到两个不同的dll中吧,C中动态载入不同的dll