|
#1
| |||
| |||
| gcc, g++, -lstdc++ what to use ?
hello all, I have a make file which looks like : CC=/usr/bin/g++ CPPFLAGS=-c -g -I/usr/local/Coral/include -I. LDFLAGS=-L/usr/local/Coral/lib -lcoral -lpcap -lhashtab -lz OBJECTS=coral_test.o \ recycle.o \ lookupa.o \ hashtab.o TARGET=coral $(TARGET): $(OBJECTS) $(CC) -g -o $(TARGET) $(OBJECTS) $(LDFLAGS) coral_test.o: coral_test.c Makefile $(CC) $(CPPFLAGS) coral_test.c clean: rm -rf $(OBJECTS) $(TARGET) It includes complilation for hash functions and a custom software files. But when i try to make it give me error as : /usr/bin/g++ -c -g -I/usr/local/Coral/include -I. coral_test.c coral_test.c: In function 'void removeall(htab*)': hashtab.h:162: error: too many arguments to function 'word hfirst()' coral_test.c:67: error: at this point in file coral_test.c:68: error: ISO C++ forbids comparison between pointer and integer hashtab.h:152: error: too many arguments to function 'word hdel()' coral_test.c:69: error: at this point in file hashtab.h:192: error: too many arguments to function 'word hnbucket()' coral_test.c:70: error: at this point in file coral_test.c: In function 'int getStatusValue(ub1*, ub1*, htab*, int)': coral_test.c:76: error: invalid conversion from 'ub1*' to 'const char*' coral_test.c:76: error: initializing argument 1 of 'size_t strlen(const char*)' hashtab.h:120: error: too many arguments to function 'word hfind()' coral_test.c:84: error: at this point in file hashtab.h:120: error: too many arguments to function 'word hfind()' coral_test.c:84: error: at this point in file hashtab.h:120: error: too many arguments to function 'word hfind()' coral_test.c:88: error: at this point in file coral_test.c:89: error: invalid conversion from 'void*' to 'ub1*' hashtab.h:120: error: too many arguments to function 'word hfind()' coral_test.c:97: error: at this point in file coral_test.c:98: error: invalid conversion from 'void*' to 'ub1*' coral_test.c:99: error: ISO C++ forbids comparison between pointer and integer coral_test.c: In function 'int insert(htab*, ub1*, ub1*, int, int)': coral_test.c:114: error: invalid conversion from 'ub1*' to 'const char*' coral_test.c:114: error: initializing argument 1 of 'size_t strlen(const char*)' hashtab.h:133: error: too many arguments to function 'word hadd()' coral_test.c:123: error: at this point in file hashtab.h:120: error: too many arguments to function 'word hfind()' coral_test.c:125: error: at this point in file hashtab.h:152: error: too many arguments to function 'word hdel()' coral_test.c:126: error: at this point in file hashtab.h:133: error: too many arguments to function 'word hadd()' coral_test.c:127: error: at this point in file coral_test.c: In function 'void process_packet(coral_iface_t*, coral_pkt_result_t*, htab*)': coral_test.c:164: error: invalid conversion from 'char*' to 'ub1*' coral_test.c:165: error: invalid conversion from 'char*' to 'ub1*' coral_test.c:167: error: invalid conversion from 'ub1*' to 'char*' coral_test.c:167: error: initializing argument 1 of 'char* strcpy(char*, const char*)' coral_test.c:168: error: invalid conversion from 'ub1*' to 'char*' coral_test.c:168: error: initializing argument 1 of 'char* strcat(char*, const char*)' coral_test.c:169: error: invalid conversion from 'ub1*' to 'char*' coral_test.c:169: error: initializing argument 1 of 'char* strcat(char*, const char*)' coral_test.c:171: error: invalid conversion from 'ub1*' to 'char*' coral_test.c:171: error: initializing argument 1 of 'char* strcpy(char*, const char*)' coral_test.c:172: error: invalid conversion from 'ub1*' to 'char*' coral_test.c:172: error: initializing argument 1 of 'char* strcat(char*, const char*)' coral_test.c:173: error: invalid conversion from 'ub1*' to 'char*' coral_test.c:173: error: initializing argument 1 of 'char* strcat(char*, const char*)' coral_test.c:187: error: invalid conversion from 'short unsigned int' to 'ub1*' coral_test.c:188: error: invalid conversion from 'short unsigned int' to 'ub1*' coral_test.c: In function 'int main(int, char**)': hashtab.h:76: error: too many arguments to function 'htab* hcreate()' coral_test.c:235: error: at this point in file hashtab.h:76: error: too many arguments to function 'htab* hcreate()' coral_test.c:236: error: at this point in file hashtab.h:162: error: too many arguments to function 'word hfirst()' coral_test.c:322: error: at this point in file coral_test.c:326: error: invalid conversion from 'void*' to 'ub1*' coral_test.c:341: error: invalid conversion from 'ub1*' to 'const char*' coral_test.c:341: error: initializing argument 1 of 'size_t strlen(const char*)' hashtab.h:133: error: too many arguments to function 'word hadd()' coral_test.c:347: error: at this point in file hashtab.h:192: error: too many arguments to function 'word hnbucket()' coral_test.c:350: error: at this point in file hashtab.h:162: error: too many arguments to function 'word hfirst()' coral_test.c:352: error: at this point in file hashtab.h:192: error: too many arguments to function 'word hnbucket()' coral_test.c:357: error: at this point in file make: *** [coral_test.o] Error 1 I have tried changing the compiler to g++ and using the -lstdc++ flag but everytime it gives me an error can someone help me with this. What should i used here. Thanks a lot |
|
#2
| |||
| |||
|
Your problem is the code, it is too old gnu c++. It still have option -traditional, but it does nothing. So, fix each error by hand. The messages tell the problem: the code uses integers, where is should use pointers etc. |
|
#3
| |||
| |||
|
But how come when i compile my code separately ie. the coral_test.c and the hash implementation they just work fine. But when i try to merge both the codes together i get these errors. Is there some problem in my make file. Can you please let me know. Because i just wrote it using information from net. my structure looks like for hash: -rw-r--r-- 1 hetawal hetawal 8753 Mar 29 15:24 hashtab.c -rw-r--r-- 1 hetawal hetawal 6355 Mar 29 15:23 hashtab.h -rw-r--r-- 1 root hetawal 3584 Apr 11 01:08 hashtab.o -rw-r--r-- 1 hetawal hetawal 8486 Mar 29 15:23 lookupa.c -rw-r--r-- 1 hetawal hetawal 692 Mar 29 15:23 lookupa.h -rw-r--r-- 1 root hetawal 4776 Apr 11 01:08 lookupa.o -rw-r--r-- 1 hetawal hetawal 325 Apr 11 01:08 makefile -rw-r--r-- 1 hetawal hetawal 2104 Mar 29 15:23 recycle.c -rw-r--r-- 1 hetawal hetawal 2036 Mar 29 15:23 recycle.h -rw-r--r-- 1 root hetawal 1392 Apr 11 01:08 recycle.o -rw-r--r-- 1 hetawal hetawal 29 Mar 29 15:29 sa.txt -rw-r--r-- 1 hetawal hetawal 1617 Mar 29 15:23 standard.h -rwxr-xr-x 1 root hetawal 22696 Apr 11 01:08 test -rw-r--r-- 1 hetawal hetawal 138 Apr 8 13:56 ttl.c -rw-r--r-- 1 hetawal hetawal 120 Apr 8 13:56 ttl.h -rwxr-xr-x 1 hetawal hetawal 22196 Apr 8 19:16 unique -rw-r--r-- 1 hetawal hetawal 4429 Apr 8 21:19 unique.c when i just compile unique.c it works fine alone. And when i try to use the code in my coral_test.c as describe in my above email. It gives me error. Same is case with my coral_test.c when compiled separtalety. Can you please help me to merge them together Thanks |
![]() |
| Bookmarks |
| Thread Tools | |
|
|