htdefiant 0 Report post Posted August 8, 2007 (edited) I just installed DevC++ Beta 4.9.9.2, the Stanford University standard. Then downloaded 4 extended libraries that my professor gave me, and ran a test program that was also given to me. Attached is my screenshot of errors. Something is wrong with the extended libraries, it looks like. Thoughts? Edited August 10, 2007 by htdefiant (see edit history) Share this post Link to post Share on other sites
osknockout 0 Report post Posted August 10, 2007 Hi. It seems your problems aren't that bad actually. (I was thinking random library-object file error when I was reading the post)Ok, I'm going by the order that the actual errors were reported in the Dev-C++ screenshot.First: I don't know why, but one of your libraries defines 'bool' a second time. Go to line 61 of genlib.h and remove the bool definitionthere. There shouldn't be too many problems coming from that one line.Second: Ok, I think you need to add cstring.h to the header since the functions that are missing are probably from there.An include <cstring> should do it.Third/Fourth: As for lines 37 and 38, you're going to have to show the source code for us to find what's wrong, but it seems youjust have an error in the test program there, probably with string format problems.If the first two don't work, go to your professor and complain that someone in the department's slacking off. Share this post Link to post Share on other sites
htdefiant 0 Report post Posted August 10, 2007 Thank you osknockout. I did the first step, but my knowledge of C is very limited. Can you please elaborate on the 2nd and 3rd things I need to do? Also I recompiled the test program and the genlib did not cause an error this time.Thanks a ton for your help. Share this post Link to post Share on other sites
htdefiant 0 Report post Posted August 10, 2007 I recopied the extended libraries just to make sure I had the correct ones. I got a new error list. Share this post Link to post Share on other sites
osknockout 0 Report post Posted August 10, 2007 No problem.I think you can skip the second step now. What happened before was that the functions strncpy and strcpy were not available.They're defined in string.h (not cstring.h - that was my mistake. It's cstring.h in C++ but just string.h in C)I was thinking that whoever made the libraries forgot to include string.h - just a simple #include <string,h> would have worked.Like I said, I'm pretty sure you don't need to do that because the library seems to work fine with those functions now.Now for the third thing: Ok, the error you made was very simple - an innocent error actually. You put one line of code on two lines.You can't do that normally. Here's your code: printf("%s and %s converted to upper case is %s and%s\n\n", str1,st2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); What happens is that the compiler thinks that the second line is a different statement from the first.What you have to do is put all of that code on only one line, OR you can put a / on the last "and" in the first lineto tell the compiler that your code continues to the next line. / is the continuation character when put at the end of the line.So your code should look like:printf("%s and %s converted to upper case is %s and %s\n\n", str1,st2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); or:printf("%s and %s converted to upper case is %s and \%s\n\n", str1,st2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); It looks like that should cover everything. Do tell if there are more errors, I might have missed something accidentally. Share this post Link to post Share on other sites
htdefiant 0 Report post Posted August 11, 2007 (edited) OK. I am so sorry to be such a newbie at this. But, I just got so frustrated I deleted the file I was working on. This is the file that Stanford supplies you with to "test" your compiler: /* This is a test program. This will check to see if the extended libraries are working finein your compiler.Please make sure that all the printf statements are in one single line. E.gprintf("%s and %s converted to upper case is %s and%s\n\n",str1,str2,ConvertToUpperCase(str1),ConvertToUpperCase(str2));*/#include <stdio.h>#include "genlib.h"#include "simpio.h"#include "strlib.h"#include "random.h"int main(int){int num,i;long num1;double num2;string line;string str1 = "chimpanzee"; string str2 = "gorilla";//test simpio.h functionsprintf("Enter integer: ");num = GetInteger();printf("%d entered\n",num);printf("Enter long: ");num1 = GetLong();printf("%ld entered\n",num1);printf("Enter real: ");num2 = GetReal();printf("%lf entered\n",num2);printf("Enter string: ");line = GetLine();printf("%s entered\n\n",line);//test strlib.h functionsprintf("Concatenate %s and %s: %s\n",str1,str2,Concat(str1,str2));printf("6th char of %s is %c\n",str1,IthChar(str1,5));printf("Substring of %s from 3 to 7 is %s\n",str1,SubString(str1,3,7));printf("%s and %s converted to upper case is %s and%s\n\n",str1,str2,ConvertToUpperCase(str1),ConvertToUpperCase(str2));//this loops test a function in random.hprintf("Here are 15 random integers from 1 to 50: ");for (i=0 ; i < 15 ; i++){printf("%d ", RandomInteger(1,50));}printf("\n");getchar(); /*this line is needed so that the output screen will remain as it is till the userenters a key on the keyboard*/}The first attachment is the picture of my errors.The second is a folder with the extended libraries I sent to the includes folder.The third is a folder (extlibnew.zip) with the replacements for for strlib.h and genlib.h.Sorry to be so much trouble. I won't make any more adjustments until I hear from you. Thanks again, os. extendedLibDevC__.zip extlibnew.zip Edited August 11, 2007 by htdefiant (see edit history) Share this post Link to post Share on other sites
osknockout 0 Report post Posted August 12, 2007 Hey, no problem.Ok, see the beginning disclaimer statement they have? Please make sure that all the printf statements are in one single line. E.gprintf("%s and %s converted to upper case is %s and%s\n\n",str1,str2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); You're supposed to put printf("%s and %s converted to upper case is %s and%s\n\n",str1,str2,ConvertToUpperCase(str1),ConvertToUpperCase(str2)); as printf("%s and %s converted to upper case is %s and %s\n\n",str1,str2,ConvertToUpperCase(str1),ConvertToUpperCase(str2));[That's basically the only problem you have. Otherwise, your libraries are compiling perfectly.So make those two lines into one, recompile, and send us some feedback. Share this post Link to post Share on other sites
htdefiant 0 Report post Posted August 12, 2007 (edited) I owe you one osknockout. Thanks for making me proofread! I pressed the delete button, and then the program compiled perfectly. Thanks a ton. If there is anything I can ever do for you... Edited August 12, 2007 by htdefiant (see edit history) Share this post Link to post Share on other sites
osknockout 0 Report post Posted August 14, 2007 Alright. ^^ Well, in case I ever need anything, I'll know who to contact :XD: Share this post Link to post Share on other sites