Computing.Net > Forums > Programming > Odd problem trying to compile C++

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Odd problem trying to compile C++

Reply to Message Icon

Name: Nick Jacobsen
Date: November 27, 2002 at 11:52:41 Pacific
OS: WindowsXPSP1/Cygwin
CPU/Ram: 500Mhz/300MB
Comment:

I am trying to compile a C++ program, and I keep on getting the following errors. I am using Cygwin, and of course GCC. I have checked to make sure there are no syntax errors.

-------- ERRORS -------------
In file included from main.c:25:
main.h:37: parse error before '*' token
main.h:37: `uint32_t' declared as function returning a function
main.h:55: parse error before "get_cipher_func"
main.h:55: warning: no semicolon at end of struct or union
main.h:56: warning: data definition has no type or storage class
main.h:58: parse error before '}' token
In file included from main.c:26:
ssl2.h:55: field `cipher' declared as a function
ssl2.h:56: field `ciphers' declared as a function
ssl2.h:62: parse error before "host"
ssl2.h:63: parse error before "host"
main.c:33: field `func_addr' declared as a function
main.c:41: warning: initialization makes pointer from integer without a cast
main.c:46: warning: initialization makes pointer from integer without a cast
main.c:52: warning: initialization makes pointer from integer without a cast
main.c:58: warning: initialization makes pointer from integer without a cast
main.c:64: warning: initialization makes pointer from integer without a cast
main.c:69: warning: initialization makes pointer from integer without a cast
main.c:74: warning: initialization makes pointer from integer without a cast
main.c:79: warning: initialization makes pointer from integer without a cast
main.c:84: warning: initialization makes pointer from integer without a cast
main.c:89: warning: initialization makes pointer from integer without a cast
main.c:95: warning: initialization makes pointer from integer without a cast
main.c:101: warning: initialization makes pointer from integer without a cast
main.c:106: warning: initialization makes pointer from integer without a cast
main.c:111: warning: initialization makes pointer from integer without a cast
main.c:116: warning: initialization makes pointer from integer without a cast
main.c:121: warning: initialization makes pointer from integer without a cast
main.c:126: warning: initialization makes pointer from integer without a cast
main.c:131: warning: initialization makes pointer from integer without a cast
main.c:136: warning: initialization makes pointer from integer without a cast
main.c:141: warning: initialization makes pointer from integer without a cast
main.c:146: warning: initialization makes pointer from integer without a cast
main.c:151: warning: initialization makes pointer from integer without a cast
main.c: In function `info_leak':
main.c:238: dereferencing pointer to incomplete type
main.c:238: dereferencing pointer to incomplete type
main.c:249: dereferencing pointer to incomplete type
main.c:250: dereferencing pointer to incomplete type
main.c: In function `send_shellcode':
main.c:274: dereferencing pointer to incomplete type
main.c:294: dereferencing pointer to incomplete type
main.c:294: dereferencing pointer to incomplete type
main.c:314: dereferencing pointer to incomplete type
main.c:314: dereferencing pointer to incomplete type
main.c:333: dereferencing pointer to incomplete type
main.c:333: dereferencing pointer to incomplete type
main.c: In function `main':
main.c:369: `in_addr_t' undeclared (first use in this function)
main.c:369: (Each undeclared identifier is reported only once
main.c:369: for each function it appears in.)
main.c:369: parse error before "host"
main.c:437: `host' undeclared (first use in this function)
main.c:437: parse error before ')' token
----------- END ERRORS --------------

----------- Start Code --------------
/* host to big endian conversions */
#define htobes(i, p) if ( (((uint8_t*)p)[0] = (((i) >> 8) & 0xff)) | \
(((uint8_t*)p)[1] = ((i) & 0xff)) ) {}

#define htobel(i, p) if ( (((uint8_t*)p)[0] = (((i) >> 24) & 0xff)) | \
(((uint8_t*)p)[1] = (((i) >> 16) & 0xff)) | \
(((uint8_t*)p)[2] = (((i) >> 8) & 0xff)) | \
(((uint8_t*)p)[3] = ((i) & 0xff)) ) {}

/* host to little endian conversions */
#define htoles(i, p) if ( (((uint8_t*)p)[1] = (((i) >> 8) & 0xff)) | \
(((uint8_t*)p)[0] = ((i) & 0xff)) ) {}

#define htolel(i, p) if ( (((uint8_t*)p)[3] = (((i) >> 24) & 0xff)) | \
(((uint8_t*)p)[2] = (((i) >> 16) & 0xff)) | \
(((uint8_t*)p)[1] = (((i) >> 8) & 0xff)) | \
(((uint8_t*)p)[0] = ((i) & 0xff)) ) {}

/* big endian to host conversions */
#define betohs(p) ( (((uint32_t)((uint8_t*)p)[0]) << 8) | \
(((uint32_t)((uint8_t*)p)[1])) )

#define betohl(p) ( (((uint32_t)((uint8_t*)p)[0]) << 24) | \
(((uint32_t)((uint8_t*)p)[1]) << 16) | \
(((uint32_t)((uint8_t*)p)[2]) << 8) | \
(((uint32_t)((uint8_t*)p)[3])) )

/* little endian to host conversions */
#define letohs(p) ( (((uint32_t)((uint8_t*)p)[1]) << 8) | \
(((uint32_t)((uint8_t*)p)[0])) )

#define letohl(p) ( (((uint32_t)((uint8_t*)p)[3]) << 24) | \
(((uint32_t)((uint8_t*)p)[2]) << 16) | \
(((uint32_t)((uint8_t*)p)[1]) << 8) | \
(((uint32_t)((uint8_t*)p)[0])) )

typedef uint32_t (*get_cipher_func)(unsigned char*, int);
typedef int (*build_shellcode_func)(unsigned char*, int, int, uint32_t, uint32_t, uint32_t);

/* This structure defines a target architecture */
struct architecture {
char* desc; /* description */

unsigned char* overwrite_session_id_length;
int overwrite_session_id_length_len;

/* stage2 shellcode */
unsigned char* shellcode_stage2;
int shellcode_stage2_len;

/* the tag written by the stage1 shellcode */
unsigned char* tag;
int tag_len;

get_cipher_func get_cipher;
get_cipher_func get_ciphers;
build_shellcode_func build_shellcode;
};

/* EOF */
------------- End Code ----------------



Sponsored Link
Ads by Google

Response Number 1
Name: alex
Date: November 27, 2002 at 12:18:05 Pacific
Reply:

Looks like you have problems with the declarations.
get_cipher - a function pointer or whatever it is suppose to be... you got it wrong either way.
When you fix that you will get rid of most of your parcing errors.
And check your pointers


0

Response Number 2
Name: cup
Date: November 29, 2002 at 21:52:37 Pacific
Reply:

Try adding the definitions for uint32_t and uint8_t before your typedefs. Looks like it doesn't know what uint32_t is. Probably something like

typedef unsigned long uint32_t;


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Odd problem trying to compile C++

C prototype errors on compile www.computing.net/answers/programming/c-prototype-errors-on-compile/1536.html

how to compile C program in edit pl www.computing.net/answers/programming/how-to-compile-c-program-in-edit-pl/8975.html

What Do I Use To Compile This With? www.computing.net/answers/programming/what-do-i-use-to-compile-this-with/1061.html