Thursday, December 30, 2010

unresolved overloaded function type

error: no matching function for call to class1::input(void*, unresolved overloaded function type)
note: candidates are: int class1::input(void*, int (class1::*)(void*, int))

if your function call is like
input( (void*)&cur_msg, class1::input);

change it to
input( (void*)&cur_msg, &class1::input);

Its basically a function pointer, so you need to pass address of that function

Tuesday, December 28, 2010

error: TIOCFLUSH was not declared in this scope

include "sys/ioctl.h" on Linux, change TIOCFLUSH to TCFLSH in ioctl call

error: expected constructor, destructor, or type conversion before & token

If you get the following error
"error: expected constructor, destructor, or type conversion before & token"
or
"error: expected initializer before & token"

Add "std::" before the token, if token is part of std namespace.
like std::ostream.
You can also think of adding "using namespace std;" in your source file but Please don't add using line in your header file.

Thursday, December 23, 2010

error: extra qualification on member

If you get the above error, just remove the extra scope resolution operator,:: and it should work fine.

Monday, December 20, 2010

error: ostrstream was not declared in this scope

If you get such errors
"error: ostrstream was not declared in this scope"

try to include its relevant header file and/or namespace.

For this error, include or along with using namespace std;

Saturday, December 18, 2010

Yacc and Lex

In Linux,
Yacc is a script which calls Bison (Yacc supported utility on Linux).
Lex is a script which calls Flex (Lex supported utility on Linux).

If you face linking issue for lex, please change "-ll" to "-lfl". Yacc should work with "-ly" as usual.

If you get following error,
"error: macro "yywrap" passed 1 arguments, but takes just 0"

Change "#define yywrap() 1" to "%option noyywrap".
Note put this option line outside of %{ ...}% section. This section is for the code which needs to get directly into the generated .c file.

Wednesday, December 15, 2010

Compiler Flags

cc/CC Flags on Solaris------>gcc/g++ Flags on Linux
===================================================
"-fast" ------> "-O2"
"-O5" ------> "-O3"
"-xarch" ------> "-mcpu, -march"
"-xchip" ------> No Equivalent in Linux (probably not required)
"-PIC/KPIC" -----> "-fPIC"
"-library" --------> "-I Include Path -L Lib Path"
"-compat=5" -------> "-fabi-version=2"
"-D__SUNPRO_C" ------> "__VERSION__"
"-ptr" -------------> No equivalent in Linux, not required.
"-ll" -------------> "-lfl" - For linking lex, as Linux has Flex