Dev - C++ - Ignoring old commands for target

   
Vista:

Ignoring old commands for target

Publicado por jorge (2 intervenciones) el 03/10/2015 06:23:40
Hola estoy tratando de compilar chatterbot y me sale este error:

[Warning]"overriding commands for target"
[Warning]"Ignoring old commands for target"
[Warning]"extra tokens at end of #include directive

Este es el make:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Makefile win
 
# Project: Chatterbot13
# Makefile created by Dev-C++ 4.9.9.2
 
CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  =
OBJ  = chatterbot13.o strings.o script.o Chatterbot13.o $(RES)
LINKOBJ  = chatterbot13.o strings.o script.o Chatterbot13.o $(RES)
LIBS =  -L"C:/Dev-Cpp/lib" -L"C:/Documents and Settings/Norma/Mis documentos/proyectos varios/Chatterbot_c"
INCS =  -I"C:/Dev-Cpp/include"
CXXINCS =  -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"
BIN  = Chatterbot13.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm -f
 
.PHONY: all all-before all-after clean clean-custom
 
all: all-before Chatterbot13.exe all-after
 
 
clean: clean-custom
	${RM} $(OBJ) $(BIN)
 
$(BIN): $(OBJ)
	$(CPP) $(LINKOBJ) -o "Chatterbot13.exe" $(LIBS)
 
chatterbot13.o: chatterbot13.cpp
	$(CPP) -c chatterbot13.cpp -o chatterbot13.o $(CXXFLAGS)  // Acá un error
 
strings.o: strings.cpp
	$(CPP) -c strings.cpp -o strings.o $(CXXFLAGS)
 
script.o: script.txt
	$(CPP) -c script.txt -o script.o $(CXXFLAGS)
 
Chatterbot13.o: Chatterbot13.dsp
	$(CPP) -c Chatterbot13.dsp -o Chatterbot13.o $(CXXFLAGS)   // y acá otro


Tengo todos los archivos en la carpeta raiz del proyecto y el error - [Warning]"extra tokens at end of #include
directive - me lo dá en el archivo string.cpp

Huelga decir que c++ no es mi fuerte pero por el momento preciso resolver este problema y por supuesto comprenderlo de cara al futuro así que toda ayuda será bienvenida, gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Ignoring old commands for target

Publicado por agustin (310 intervenciones) el 03/10/2015 10:57:44
Pon tu código fuente para ver que puede estar pasando.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Ignoring old commands for target

Publicado por jorge (2 intervenciones) el 04/10/2015 03:12:48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#include "chatterbot13.h"
 
 
transpos_t transposList[] = {
	{" MYSELF ", " YOURSELF "},
	{" DREAMS ", " DREAM "},
	{" WEREN'T ", " WASN'T "},
	{" AREN'T ", " AM NOT "},
	{" I'VE ", " YOU'VE "},
	{" MINE ", " YOURS "},
	{" MY ", " YOUR "},
	{" WERE ", " WAS "},
	{" MOM ", " MOTHER "},
	{" I AM ", " YOU ARE "},
	{" I'M ", " YOU'RE "},
	{" DAD ", " FATHER "},
	{" MY ", " YOUR "},
	{" AM ", " ARE "},
	{" I'D ", " YOU'D "},
	{" I ", " YOU "},
	{" ME ", " YOU "}
};
 
size_t transposListSize = sizeof(transposList) / sizeof(transposList[0]);
 
 
void CBot::loadDatabase()
{
	std::fstream fin("script.txt", std::ios::in);
	if(fin.fail())
	{
		throw std::string("Unable to load the database: script.txt");
	}
 
	CResponse respObj;
	std::vector<CResponse> ListOfRespObj;
 
	std::string buffer;
	vstring keyList;
 
	while(std::getline(fin, buffer))
	{
		char cSymbol = buffer[0];
		buffer.erase(0, 1);
		switch(cSymbol)
		{
		case 'K':
			keyList.push_back(buffer);
			break;
		case 'C':
			respObj.addContext(buffer);
			break;
		case 'R':
			respObj.addResp(buffer);
			break;
		case '%':
			ListOfRespObj.push_back(respObj);
			respObj.clear();
			break;
		case '#':
			{
				if(ListOfRespObj.empty())
				{
					ListOfRespObj.push_back(respObj);
				}
 
				vstring::const_iterator iter = keyList.begin();
				for( ; iter != keyList.end(); ++iter )
				{
					KnowledgeBase[*iter] = ListOfRespObj;
				}
				keyList.clear();
				ListOfRespObj.clear();
				respObj.clear();
			}
			break;
		}
	}
	fin.close();
}
 
void CBot::signon()
{
	handle_event("SIGNON**");
	select_response();
	//speak(m_sResponse);
	print_response();
}
 
void CBot::get_input()
{
	std::cout << ">";
 
	// saves the previous input
	save_prev_input();
	std::getline(std::cin, m_sInput);
}
 
void CBot::preprocess_input()
{
	cleanString(m_sInput);
	trimRight(m_sInput, ". ");
	UpperCase(m_sInput);
}
 
void CBot::preprocess_response()
{
	if(m_sResponse.find("*") != std::string::npos)
	{
		// extracting from input
		find_subject();
		// conjugating subject
		transpose(m_sSubject);
 
		replace(m_sResponse, "*", " " + m_sSubject);
	}
}
 
void CBot::extractRespList(std::vector<CResponse> objList)
{
	std::vector<CResponse>::const_iterator iter = objList.begin();
	for( ; iter != objList.end(); ++iter )
	{
		vstring ListOfContext = iter->getContextList();
		if(ListOfContext.empty())
		{
			ListOfResponse = iter->getRespList();
		}
		else if(std::find(ListOfContext.begin(),
			ListOfContext.end(), m_sPrevResponse) != ListOfContext.end())
		{
			ListOfResponse = iter->getRespList();
			break;
		}
	}
}
 
void CBot::find_subject()
{
	m_sSubject.erase(); // resets subject variable
	trimRight(m_sInput, " ");
	trimLR(m_sKeyWord, "_");
	size_t pos = m_sInput.find(m_sKeyWord);
	if(pos != std::string::npos)
	{
		m_sSubject = m_sInput.substr(pos + m_sKeyWord.length() + 1, m_sInput.length() - 1);
	}
}
 
bool CBot::user_repeat() const
{
	return (m_sPrevInput.length() > 0 &&
		((m_sInput == m_sPrevInput) || (m_sInput.find(m_sPrevInput) != std::string::npos) ||
		(m_sPrevInput.find(m_sInput) != std::string::npos)));
}
 
bool CBot::similar_input() const
{
	return (m_sInput.length() > 0 && (m_sInput.find(m_sPrevInput) != std::string::npos ||
			m_sPrevInput.find(m_sInput) != std::string::npos));
}
 
std::string CBot::get_sub_phrase(vstring wordList, size_t start, size_t end_pos)
{
	std::string buffer;
	for(int i = start; i < end_pos; ++i)
	{
		buffer += wordList[i];
		if(i != end_pos - 1)
		{
			buffer += " ";
		}
	}
	return buffer;
}
 
void CBot::preProcessKeyWord(std::string &str, size_t start_pos, size_t end_pos, size_t iSize)
{
	if(start_pos == 0)
	{
		str.insert(0, "_");
	}
	if(end_pos == iSize - 1)
	{
		str.insert(str.length(), "_");
	}
}
 
// implementing the 'sentence transposition' feature
void CBot::transpose(std::string &str)
{
	std::string buffer = " " + str + " ";
	bool bTransposed = 0;
 
	for(int i = 0; i < transposListSize; ++i)
	{
		std::string first = transposList[i].first;
		std::string second = transposList[i].second;
 
		while(replace(buffer, first, second) != std::string::npos)
		{
			bTransposed = 1;
		}
	}
 
	if( !bTransposed )
	{
		for( i = 0; i < transposListSize; ++i )
		{
			std::string first = transposList[i].first;
			std::string second = transposList[i].second;
			while(replace(buffer, second, first) != std::string::npos) ;
		}
	}
	trimLR(buffer, " ");
	str = buffer;
}
 
/// make a search for the user's input
// inside the database of the program
void CBot::find_match()
{
	//std::fstream outfile("keywords.txt", std::ios::out);
	ListOfResponse.clear();
 
	// introduce thse new "string variable" to help 
	// support the implementation of keyword ranking 
	// during the matching process
	std::string bestKeyWord;
	vstring ListOfWord;
 
	if(m_sInput.find("**") == std::string::npos)
	{
		trimRight(m_sInput, ".");
		UpperCase(m_sInput);
		tokenize(m_sInput, ListOfWord);
		bestKeyWord = findBestKey(ListOfWord);
		m_sKeyWord = bestKeyWord;
	}
	else
	{
		m_sKeyWord = m_sInput;
	}
	if(KnowledgeBase.find(m_sKeyWord) != KnowledgeBase.end())
	{
		std::vector<CResponse> ListOfRespObj = KnowledgeBase[m_sKeyWord];
		extractRespList(ListOfRespObj);
	}
}
 
std::string CBot::findBestKey(vstring v)
{
	std::string buffer;
	int iSize = v.size();
	bool bKeyFound = 0;
	for( int i = 0, j = iSize; i < iSize && j >= 1; ++i, --j )
	{
		for( int k = 0; (k + j) <= iSize; ++k )
		{
			buffer = get_sub_phrase(v, k, k + j);
			if(KnowledgeBase.find(buffer) != KnowledgeBase.end())
			{
				bKeyFound = 1;
			}
			else
			{
				preProcessKeyWord(buffer, k, k + j, iSize);
				if(KnowledgeBase.find(buffer) != KnowledgeBase.end())
				{
					bKeyFound = 1;
				}
			}
			if(bKeyFound)
			{
				return buffer;
			}
		}
	}
	return buffer;
}
 
void CBot::select_response()
{
	shuffle(ListOfResponse, ListOfResponse.size());
	m_sResponse = ListOfResponse[0];
}
 
void CBot::respond()
{
	save_prev_response();
	set_event("BOT UNDERSTAND**");
 
	if(null_input())
	{
		handle_event("NULL INPUT**");
	}
	else if(null_input_repetition())
	{
		handle_event("NULL INPUT REPETITION**");
	}
	else if(user_repeat())
	{
		handle_user_repetition();
	}
	else
	{
		find_match();
	}
 
	if(user_want_to_quit())
	{
		m_bQuitProgram = 1;
	}
 
	if(!bot_understand())
	{
		handle_event("BOT DON'T UNDERSTAND**");
	}
 
	if(ListOfResponse.size() > 0)
	{
		select_response();
		preprocess_response();
 
		if(bot_repeat())
		{
			handle_repetition();
		}
		print_response();
		//speak(m_sResponse);
	}
}
 
void CBot::Initialize_TTS_Engine()
{
	if(FAILED(::CoInitialize(NULL)))
	{
		throw std::string("Unable to initialise COM objects");
	}
 
	HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&m_pVoice);
 
	if(FAILED(hr))
	{
		throw std::string("Unable to initialize voice engine");
	}
 
	m_bTTSEngineInitialised = 1;
}
 
void CBot::Release_TTS_Engine()
{
	if(m_bTTSEngineInitialised)
	{
		m_pVoice->Release();
		m_pVoice = NULL;
		::CoUninitialize();
	}
}
 
void CBot::speak(const std::string text)
{
	if(m_bTTSEngineInitialised)
	{
		WCHAR *buffer = new WCHAR[text.length() + 1];
		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, text.c_str(), -1, buffer, text.length() + 1);
		m_pVoice->SetRate(-1);
		m_pVoice->Speak(buffer, SPF_DEFAULT, NULL);
		delete [] buffer;
	}
}
 
void CBot::handle_repetition()
{
	if(ListOfResponse.size() > 0)
	{
		ListOfResponse.erase(ListOfResponse.begin());
	}
	if(no_response())
	{
		save_input();
		set_input(m_sEvent);
 
		find_match();
		restore_input();
	}
	select_response();
}
 
void CBot::handle_user_repetition()
{
	if(same_input())
	{
		handle_event("REPETITION T1**");
	}
	else if(similar_input())
	{
		handle_event("REPETITION T2**");
	}
}
 
void CBot::handle_event(std::string str)
{
	save_prev_event();
	set_event(str);
 
	save_input();
 
	set_input(str);
 
	if(!same_event())
	{
		find_match();
	}
 
	restore_input();
}
 
int main()
{
	std::cout << "Chatterbot v13.0 Copyright (C) 2010 Gonzales Cenelia\n" << std::endl;
	try
	{
		CBot bot("Chatterbot13");
 
		bot.signon();
		while(!bot.quit())
		{
			bot.get_input();
			bot.respond();
		}
	}
	catch(std::string str)
	{
		std::cerr << str << std::endl;
	}
	catch(...)
	{
		std::cerr << "The program has stop due to some unknown exception" << std::endl;
	}
 
	return 0;
}


----------------------------------------------------------------------------------------------------------------------------------------------------
y esto es lo que encontré, está en inglis y cuando lo pongo a traducir queda ininteligible:

Did the previous advice work? My makefile knowledge is a bit rusty but this...

dllmain.o: dllmain.def
$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)

... is saying to produce dllmain.o (the object code for dllmain.cpp), execute the command "$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)". Clearly incorrect since your source file is dllmain.cpp.

The dllmain.def after the colon (on the first line), is OK... That is just saying that if the def file changes, recompile dllmain.cpp.

---------------------------------------------------------------------------------------------------------------------------------------
p.d. gracias por responder de inmediato.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar