我正在使用sourceforge上的c BACnet堆栈。 http://sourceforge.net/projects/bacnet/
我正在尝试修改库中包含的演示服务器。该服务器几乎可以完全满足我的要求,只是需要将其连接到我编写的其他c程序上。
我现在的问题是我不知道如何将自己的c程序添加到演示服务器中。演示中有几个嵌套的Makefile。我尝试将文件添加到这些Makefile中,但是编译器(gcc)不喜欢它。
最新的错误是:没有规则可以成为目标../../demo/object/test.o’, needed by。停止。
我不是交流专家。我的业余时间已经使用了大约一年。我了解Makefile的基础知识,但是此演示中的Makefile显然超出了我的范围。
有没有人熟悉这个库,可能会给我一些帮助?
是否有比sourceforge网站上更好的文档?
在此示例中,我只是尝试将test.c添加到ai.c。
/ demo / server / Makefile OBJECT_SRC = \ $(BACNET_OBJECT)/device.c \ $(BACNET_OBJECT)/ai.c \ $(BACNET_OBJECT)/ao.c \ $(BACNET_OBJECT)/av.c \ $(BACNET_OBJECT)/bi.c \ $(BACNET_OBJECT)/bo.c \ $(BACNET_OBJECT)/bv.c \ $(BACNET_OBJECT)/csv.c \ $(BACNET_OBJECT)/lc.c \ $(BACNET_OBJECT)/lsp.c \ $(BACNET_OBJECT)/ms-input.c \ $(BACNET_OBJECT)/mso.c \ $(BACNET_OBJECT)/msv.c \ $(BACNET_OBJECT)/nc.c \ $(BACNET_OBJECT)/trendlog.c \ $(BACNET_OBJECT)/test.c \ <-- New entry $(BACNET_OBJECT)/bacfile.c / lib / Makefile CORE_SRC = \ $(BACNET_CORE)/apdu.c \ $(BACNET_CORE)/npdu.c \ $(BACNET_CORE)/bacdcode.c \ $(BACNET_CORE)/bacint.c \ $(BACNET_CORE)/bacreal.c \ $(BACNET_CORE)/bacstr.c \ $(BACNET_CORE)/bacapp.c \ $(BACNET_CORE)/bacprop.c \ $(BACNET_CORE)/bactext.c \ $(BACNET_CORE)/datetime.c \ $(BACNET_CORE)/indtext.c \ $(BACNET_CORE)/key.c \ $(BACNET_CORE)/keylist.c \ $(BACNET_CORE)/proplist.c \ $(BACNET_CORE)/debug.c \ $(BACNET_CORE)/bigend.c \ $(BACNET_CORE)/arf.c \ $(BACNET_CORE)/awf.c \ $(BACNET_CORE)/cov.c \ $(BACNET_CORE)/dcc.c \ $(BACNET_CORE)/iam.c \ $(BACNET_CORE)/ihave.c \ $(BACNET_CORE)/rd.c \ $(BACNET_CORE)/rp.c \ $(BACNET_CORE)/rpm.c \ $(BACNET_CORE)/timesync.c \ $(BACNET_CORE)/whohas.c \ $(BACNET_CORE)/whois.c \ $(BACNET_CORE)/wp.c \ $(BACNET_CORE)/wpm.c \ $(BACNET_CORE)/abort.c \ $(BACNET_CORE)/reject.c \ $(BACNET_CORE)/bacerror.c \ $(BACNET_CORE)/ptransfer.c \ $(BACNET_CORE)/memcopy.c \ $(BACNET_CORE)/filename.c \ $(BACNET_CORE)/tsm.c \ $(BACNET_CORE)/bacaddr.c \ $(BACNET_CORE)/address.c \ $(BACNET_CORE)/bacdevobjpropref.c \ $(BACNET_CORE)/bacpropstates.c \ $(BACNET_CORE)/alarm_ack.c \ $(BACNET_CORE)/event.c \ $(BACNET_CORE)/getevent.c \ $(BACNET_CORE)/get_alarm_sum.c \ $(BACNET_CORE)/readrange.c \ $(BACNET_CORE)/timestamp.c \ $(BACNET_CORE)/test.c \ <-- Do not include test.c in this Makefile at all $(BACNET_CORE)/version.c
新文件位置:
test.c is located in /src <-- Should be located in /demo/object test.h is located in /include <-- This works ok here
测试
#ifndef _TEST_INCLUDE_ #define _TEST_INCLUDE_ void printit(); #endif
#include <stdio.h> <-- Needed to add #include <stdio.h> #include "test.h" void printit (){ printf("it...."); } /demo/object/ai.c ... #include "handlers.h" #include "timestamp.h" #include "test.h" #include "ai.h" ... void Analog_Input_Init( void) { unsigned i; #if defined(INTRINSIC_REPORTING) unsigned j; #endif printit(); //***************************************************************** for (i = 0; i < MAX_ANALOG_INPUTS; i++) { printf("Initializing AI:%u\n",i); AI_Descr[i].Present_Value = 0.0f; AI_Descr[i].Out_Of_Service = false; AI_Descr[i].Units = UNITS_PERCENT; AI_Descr[i].Reliability = RELIABILITY_NO_FAULT_DETECTED; #if defined(INTRINSIC_REPORTING) AI_Descr[i].Event_State = EVENT_STATE_NORMAL; /* notification class not connected */ AI_Descr[i].Notification_Class = BACNET_MAX_INSTANCE; /* initialize Event time stamps using wildcards and set Acked_transitions */ for (j = 0; j < MAX_BACNET_EVENT_TRANSITION; j++) { datetime_wildcard_set(&AI_Descr[i].Event_Time_Stamps[j]); AI_Descr[i].Acked_Transitions[j].bIsAcked = true; } /* Set handler for GetEventInformation function */ handler_get_event_information_set(OBJECT_ANALOG_INPUT, Analog_Input_Event_Information); /* Set handler for AcknowledgeAlarm function */ handler_alarm_ack_set(OBJECT_ANALOG_INPUT, Analog_Input_Alarm_Ack); /* Set handler for GetAlarmSummary Service */ handler_get_alarm_summary_set(OBJECT_ANALOG_INPUT, Analog_Input_Alarm_Summary); #endif } }