LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Debug and test (https://www.linuxquestions.org/questions/linux-networking-3/debug-and-test-4175538788/)

shyjuu 04-04-2015 11:06 PM

Debug and test
 
How to debug and test particluar .cc file in ubuntu 12.04.

I dont want to run make command , but i want to test a particular .cc file, how to do this.

After run make command i am getting following error

Code:

IAODV::recvRequest(Packet*)
iaodv/iaodv.cc: In member function ‘void IAODV::recvRequest(Packet*)’:
iaodv/iaodv.cc:703:6: error: ‘struct hdr_iaodv_request’ has no member named ‘rq_sec’
iaodv/iaodv.cc:756:32: error: ‘struct hdr_iaodv_request’ has no member named ‘rq_sec’
iaodv/iaodv.cc:759:30: error: ‘struct hdr_iaodv_request’ has no member named ‘rq_sec’
iaodv/iaodv.cc: In member function ‘void IAODV::forward(iaodv_rt_entry*, Packet*, double)’:
iaodv/iaodv.cc:1141:33: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
iaodv/iaodv.cc: In member function ‘void IAODV::sendRequest(nsaddr_t)’:
iaodv/iaodv.cc:1303:7: error: ‘struct hdr_iaodv_request’ has no member named ‘rq_sec’

What is the correct way to declare this req_sec as a member of struct hdr_iaodv_request

I had tried following ways but they are giving error

Code:

//struct hdr_iaodv_request *rq_sec = HDR_IAODV_REQUEST(p);        //added by shyju
struct hdr_iaodv_request;//added by shyju
hdr_iaodv_request rq_sec;
//hdr_iaodv_request *rq_sec;          //added by shyju
//iaodv_rt_entry *rq_sec;  //added by shyju


Keith Hedger 04-05-2015 05:51 AM

error: ‘struct hdr_iaodv_request’ has no member named ‘rq_sec’
is where your error is you need to declare rq_sec before using it, also it would help to know what you are trying to compile and the particular file that the error is in, just saying you have an error wif a .cc filendoen't help much

shyjuu 04-05-2015 07:01 AM

1 Attachment(s)
Quote:

Originally Posted by Keith Hedger (Post 5342824)
error: ‘struct hdr_iaodv_request’ has no member named ‘rq_sec’
is where your error is you need to declare rq_sec before using it, also it would help to know what you are trying to compile and the particular file that the error is in, just saying you have an error wif a .cc filendoen't help much

I am uploading code of my .c file in which i am having error
I had declared , but the format is not correct, so it would be helpful if you provide correct format
Following is the way in which i declared it, correct me if i am wrong

//struct hdr_iaodv_request *rq_sec = HDR_IAODV_REQUEST(p); //added by shyju
struct hdr_iaodv_request;//added by shyju
hdr_iaodv_request rq_sec;
//hdr_iaodv_request *rq_sec; //added by shyju
//iaodv_rt_entry *rq_sec; //added by shyju


Thanks a lot in advance

Keith Hedger 04-05-2015 07:07 AM

Well you stil didn't answer the questions, but rq_sec is not declared anywhere in that file, if it is in a different file please post that as I can't find a declaration of rq_sec to check the syntax, if the declaration is not in any of the included headers in the file you posted you need to include the file where it is declared.

shyjuu 04-05-2015 09:05 AM

1 Attachment(s)
Quote:

Originally Posted by Keith Hedger (Post 5342842)
Well you stil didn't answer the questions, but rq_sec is not declared anywhere in that file, if it is in a different file please post that as I can't find a declaration of rq_sec to check the syntax, if the declaration is not in any of the included headers in the file you posted you need to include the file where it is declared.

Respected SIR, I am attching text file named iaodv.txt, in this file i had tried to declare rq_sec, please correct me if i am wrong, just search with "shyju", i had commented all my declaration for better reading.

thanks a lot in advance

Keith Hedger 04-05-2015 09:14 AM

you commented out your decleration! remove the '//' from trhe start of the lines

shyjuu 04-05-2015 10:15 AM

Quote:

Originally Posted by Keith Hedger (Post 5342873)
you commented out your decleration! remove the '//' from trhe start of the lines

Sir i had intentionally commented because it was not working, can u declare it in correct way t

Keith Hedger 04-05-2015 10:44 AM

Well as you wont answer the question I originally asked ie "what are you trying to compile?" I'm flying blind, the structure "hdr_iaodv_request" has already been decleacred just above your commented out code here
Code:

struct hdr_ip *ih = HDR_IP(p);

struct hdr_iaodv_request *rq = HDR_IAODV_REQUEST(p);

//struct hdr_iaodv_request *rq_sec = HDR_IAODV_REQUEST(p);        //added by shyju

iaodv_rt_entry *rt;
//iaodv_rt_entry rq_sec; //added by shyju

//struct hdr_iaodv_request;//added by shyju

//struct hdr_iaodv_request *rq_sec;  y //added by shyju

//struct hdr_iaodv_request rq_sec;  //added by shyju

//hdr_iaodv_request rq_sec;

//hdr_iaodv_request *rq_sec;          //added by shyju

, you can only declare it once.
second you declare the struture hdr_iaodv_request as
Code:

struct hdr_iaodv_request *rq = HDR_IAODV_REQUEST(p);
I assume HDR_IAODV_REQUEST(p) is a macro without knowing what that macro expands to it is impossible to know how you are declareing the structure 'hdr_iaodv_request' which is where the error from the make file is coming from.

You also seem to be confused as to the structure type 'hdr_iaodv_request' and the instance of the structure 'rq_sec'.

I would suggest going back to basics and studing the syntax of structures and the differnce between types and instances, I think this bit of code is probably beyond what you know at the moment you need to know a bit more of the basics, and also agin what are you trying to compile? can you provide a link to the source?

knudfl 04-05-2015 11:08 AM

Re #8.
Quote:

Well as you wont answer the question I originally asked ie "what are you trying to compile?"
It's "ns-allinone-2.35/ns-2.35/iaodv/" , ref. the other IAODV threads by the OP :
http://www.linuxquestions.org/questions/tags/iaodv/


-

shyjuu 04-05-2015 11:48 AM

Quote:

Originally Posted by Keith Hedger (Post 5342898)
Well as you wont answer the question I originally asked ie "what are you trying to compile?" I'm flying blind, the structure "hdr_iaodv_request" has already been decleacred just above your commented out code here[code]struct hdr_ip *ih = HDR_IP(p);

Sir I try to compile iadov.c file which is originally aodv.c , but i had done some modification to aodv.c code and given it a name iaodv.c , i get this error while running "make" commmand in ubuntu for recompiling my ns-2.35 code.

can just tell me which declaration of req_sec i should keep, so that i can try.

knudfl 04-05-2015 12:08 PM

Re #10.

Please use the right file names = aodv.cc , iaodv.cc .

shyjuu 04-05-2015 12:12 PM

Quote:

Originally Posted by knudfl (Post 5342939)
Re #10.

Please use the right file names = aodv.cc , iaodv.cc .

i had renamed it as iaodv.c sir

knudfl 04-05-2015 12:15 PM

Quote:

I had renamed it as iaodv.c
Don't do that. C++ code in ns2 must be file.cc !

shyjuu 04-05-2015 12:23 PM

Quote:

Originally Posted by knudfl (Post 5342943)
Don't do that. C++ code in ns2 must be file.cc !

yes sir it is .cc only, I am just not getting how to declare rq_sec correctly, can u declare it , i would be thankful

Keith Hedger 04-05-2015 02:29 PM

Quote:

Originally Posted by shyjuu (Post 5342948)
yes sir it is .cc only, I am just not getting how to declare rq_sec correctly, can u declare it , i would be thankful

It is NOT a case of declaring rq_sec, you are trying to access it like so:
Code:

rq->rq_sec = index; ...
which is where your error is, rq is declared here
Code:

struct hdr_iaodv_request *rq = HDR_IAODV_REQUEST(p);
And doesn't have a member called rq_sec no matter how many times or in whatever way you declare it, the above bit of code is saying "look in the structure pointed to by rq and set rq_sec to the value of index", if there is no ( which there isn't ) member in the structure of hdr_iaodv_request called rq_sec it is an error.


All times are GMT -5. The time now is 08:18 PM.