PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

Annoying messages when compiling :-[

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Yannick B.



Joined: 13 Jan 2009
Posts: 3

PostPosted: Tue Jan 13, 2009 2:09 pm    Post subject: Annoying messages when compiling :-[ Reply with quote

Hi!

I am trying to compile this simple code with the C compiler (i.e. pgcc) :

Code:

#include <windows.h>

int main(void) {
      return 0;
}


But, I get these errors =>
pgcc wrote:

PGC-W-0043-Redefinition of symbol, va_list (C:\PROGRA~1\PGI/win32/8.0-2/include\stdarg.h: 37)
PGC-W-0114-More than one type specified (C:\PROGRA~1\PGI/win32/8.0-2/include\WinNT9.h: 284)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:\PROGRA~1\PGI/win32/8.0-2/include\WinNT9.h: 284)
PGC-W-0043-Redefinition of symbol, PFORMAT_STRING (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\rpcndr.h: 547)
PGC-W-0043-Redefinition of symbol, MIDL_STUB_MESSAGE (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\rpcndr.h: 777)
PGC-W-0043-Redefinition of symbol, PMIDL_STUB_MESSAGE (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\rpcndr.h: 777)
PGC-W-0043-Redefinition of symbol, MIDL_SYNTAX_INFO (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\rpcndr.h: 1124)
PGC-W-0043-Redefinition of symbol, PMIDL_SYNTAX_INFO (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\rpcndr.h: 1124)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 380)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 380)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 382)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 382)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 384)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 384)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 386)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 386)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 686)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 686)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 691)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 691)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 1117)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\wtypes.h: 1117)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\winsmcrd.h: 31)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\winsmcrd.h: 31)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\winsmcrd.h: 33)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\winsmcrd.h: 33)
PGC-W-0043-Redefinition of symbol, LPCVOID (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\winscard.h: 47)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\objidl.h: 269)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\objidl.h: 269)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\objidl.h: 305)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\objidl.h: 305)
PGC-W-0043-Redefinition of symbol, LPTYPELIB (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 916)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 924)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 924)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 925)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 925)
PGC-W-0043-Redefinition of symbol, LPTYPEINFO (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 937)
PGC-W-0043-Redefinition of symbol, LPTYPECOMP (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 944)
PGC-W-0043-Redefinition of symbol, LPCREATETYPELIB (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 951)
PGC-W-0043-Redefinition of symbol, LPCREATETYPEINFO (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 953)
PGC-W-0043-Redefinition of symbol, LPDISPATCH (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\oleauto.h: 1047)
PGC-W-0114-More than one type specified (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\commdlg.h: 698)
PGC-W-0143-Useless typedef declaration (no declarators present) (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\commdlg.h: 698)
PGC-W-0043-Redefinition of symbol, LPUINT (C:/Program Files/PGI/Microsoft Open Tools 9/PlatformSDK/include\imm.h: 28)
PGC/x86 Windows 8.0-2: compilation completed with warnings


Of course, there must be interference between "C:\Program Files\PGI\Microsoft Open Tools 9\include" and "C:\Program Files\PGI\win32\8.0-2\include". . . How to fix that?

As I see, pgcc isnt connected with usual environment variables such as INCLUDE . . .

Im on Windows XP SP3 x32 bit . . .
Running pgcc on cmd.exe, not bash, but i get the same errors with bash w/e...


Thank you!

Cordially,

Yannick B.
Quote:
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6592
Location: The Portland Group Inc.

PostPosted: Tue Jan 13, 2009 4:57 pm    Post subject: Reply with quote

Hi Yannick,

These are just warnings and can safely be ignored. To disable warning messages, add the "-w" flag to you compilation.

Hope this helps,
Mat
Back to top
View user's profile
Yannick B.



Joined: 13 Jan 2009
Posts: 3

PostPosted: Tue Jan 13, 2009 5:42 pm    Post subject: Reply with quote

I would be partially satisfied of this answer if this was not a blocker . . .
However.

I cannot even compile such a code :

Code:

#include <windows.h>

int main(void) {
   ShellExecute(NULL, "open", "cmd.exe", "/K \"echo Hello world!\"", "C:\\WINDOWS\\system32", SW_SHOWNORMAL);
   return 0;
}


When I type this in cmd.exe
Code:

pgcc pgtest.c -w>text.txt 2>&1


The collected output of pgcc is :
pgcc wrote:

PGC/x86 Windows 8.0-2: compilation completed with warnings
pgcc4clOqHEkDFgU-.obj : error LNK2019: unresolved external symbol __imp__ShellExecuteA@24 referenced in function _main
pgtest.exe : fatal error LNK1120: 1 unresolved externals


How can I fix this?!

Thanks!!
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6592
Location: The Portland Group Inc.

PostPosted: Wed Jan 14, 2009 9:58 am    Post subject: Reply with quote

Hi Yannick,

You need to link with the library that contains this symbol.

Doing a web search, I found that "ShellExecuteA" is contained in the "shell32.dll" library. To use this DLL, you need to link with it's import library "shell32.lib". Example:
Code:
PGI$ cat test.c
#include <windows.h>
int main(void) {
   ShellExecute(NULL, "open", "cmd.exe", "/K \"echo Hello world!\"", "C:\\WINDOWS\\system32", SW_SHOWNORMAL);
   return 0;
}
PGI$ pgcc test.c -w
PGC/x86-64 Windows 8.0-3: compilation completed with warnings
pgcc4cqKSWrpW2DIS.obj : error LNK2019: unresolved external symbol __imp_ShellExecuteA referenced in function main
test.exe : fatal error LNK1120: 1 unresolved externals
PGI$ pgcc test.c -w shell32.lib
test.c:
PGC/x86-64 Windows 8.0-3: compilation completed with warnings
PGI$ ls test.exe
test.exe
PGI$


Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group