Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Compiling C Scripts Error

Hello, I'm having an error compiling a C script. I'm using GCC to compile.
It's a DNS scanner, but the problem persists with all my scanning scripts. DNS scanner source code: http://pastebin.com/Ay8cQYUS

dns.c:12:21: error: stropts.h: No such file or directory
dns.c: In function ‘flood’:
dns.c:103: warning: cast from pointer to integer of different size
dns.c: In function ‘main’:
dns.c:239: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type
/usr/include/pthread.h:225: note: expected ‘void (*)(void )’ but argument is of type ‘void (*)()’
dns.c:254: warning: cast to pointer from integer of different size

Anyone know how to fix this?

Thanks.
Anyone know how to fix this?

Yeah its line 300 in stropts.h.

How do you except us to help with no source code?
(May 28, 2015 11:02 PM)g4143 Wrote:  Anyone know how to fix this?

Yeah its line 300 in stropts.h.

How do you except us to help with no source code?

http://pastebin.com/Ay8cQYUS
That's the source code.
Do you have to link a shared object for stropts?
(May 28, 2015 11:09 PM)g4143 Wrote:  Do you have to link a shared object for stropts?

Say again? I didn't understand what you meant.
add "-pthread" at the end of the gcc command.

Example:
gcc script.c -o script -pthread
(May 28, 2015 11:24 PM)Mic Righteous Wrote:  add "-pthread" at the end of the gcc command.

Example:
gcc script.c -o script -pthread

The pthread problem wasn't a missing shared object. It was an incorrect function signature.

Quote:dns.c:239: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type
/usr/include/pthread.h:225: note: expected ‘void (*)(void )’ but argument is of type ‘void (*)()’
dns.c:254: warning: cast to pointer from integer of different size
(May 29, 2015 01:43 AM)g4143 Wrote:  The pthread problem wasn't a missing shared object. It was an incorrect function signature.

Could you perhaps give me a fix?
(May 29, 2015 01:48 AM)Kumara Wrote:  Could you perhaps give me a fix?

Well the pthread warning is the function signature here.
Code
void recievethread(){
.....
}

it should be.
Code
void recievethread(void){
.....
}
(May 29, 2015 02:01 AM)g4143 Wrote:  Well the pthread warning is the function signature here.
Code
void recievethread(){
.....
}

it should be.
Code
void recievethread(void){
.....
}

Thank you. I will test the fix ASAP.
Also for the record, there's no way you wrote this but don't know that the problem is you're missing a header. You should probably stop stealing other people's code and learn how to write your own. That's one way to fix your problems.
(May 29, 2015 06:08 AM)Mouse❤️ Wrote:  Also for the record, there's no way you wrote this but don't know that the problem is you're missing a header. You should probably stop stealing other people's code and learn how to write your own. That's one way to fix your problems.

Actually to OP did post the code with the header file but that doesn't mean its a correct header file or that the header file is present on their machine.
That's what I'm saying. He wrote all that code, but he couldn't understand "dns.c:12:21: error: stropts.h: No such file or directory". The code references a header file that's not there and he can't comprehend that.
(May 29, 2015 06:48 AM)Mouse❤️ Wrote:  That's what I'm saying. He wrote all that code, but he couldn't understand "dns.c:12:21: error: stropts.h: No such file or directory". The code references a header file that's not there and he can't comprehend that.

Well the problem could be a number of things and all of them are compiler/linker problems which can be nasty if you neglected that part of your C/C++ training.
True, true. I'm just not open to trusting new HF users that just show up with code that "doesn't work for some reason"


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by goldenmeanJun 3, 2019 01:42 PM 0 91 Jun 3, 2019 01:42 PM
Last Post: goldenmean
[C] by Karma18Feb 9, 2017 11:11 AM 8 695 Feb 9, 2017 11:11 AM
Last Post: Annabelle Lee
[C] by RxQueenJul 13, 2015 10:15 PM 2 153 Jul 13, 2015 10:15 PM
Last Post: Kantos