g++ warning: `visibility' attribute

Hello,

I use g++ 3.4 as the compiler and I encountered some problem which I didn't see in msvc

first
this code gives the warning "warning: `visibility' attribute does not apply to types"

1
2
3
4
5
6

// GCC visibility
	#define _AmzExport  __attribute__ ((visibility("default")))
	// Export for plug-ins
	#define _AmzPlugExport  __attribute__ ((visibility("default")))


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

	class _AmzExport Exception {

	public:

		// Can be used to convert line number to string
		static String lineNum(int line);

		// For a handy and fast stop action
		static void stop(String msg);

		// Gives warning
		static void warn(String msg);

	}; // warning occures here 




Second

I typedef std::string to String and the functions which take std::string as arguments gives error if I pass String as argument, so I needed to do typecasting which seems to me unnecessary, probably un efficient


third

I include <dirent.h> which does some settings then includes <sys/dirent.h>
and the structure that I use (struct dirent*) is in <sys/dirent.h> however if I include <dirent.h> directly it says it couldn't find d_type member in struct dirent however, d_type is defined in <sys/dirent.h> so if I include <sys/dirent> there isn't a problem, but including <dirent.h> must be valid since it has brought <sys/dirent.h>

even though I can compile the project, this problems annoy me.
Thank you for your help.
I upgrade my compiler to g++ 4x and first issue is solved
second
what error exactly?

third
"including <dirent.h> must be valid since it has brought <sys/dirent.h>"
I'd look inside sys/dirent.h to be sure what's going on when you include <dirent.h>. There can be some preprocessor magic, which results is that you must include <sys/dirent.h>
Also you can use -E gcc key, to examine what you got after preproc stage
Topic archived. No new replies allowed.