Annoying messages when compiling :-[

Hi!

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

#include <windows.h>

int main(void) {
      return 0;
}

But, I get these errors =>

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.

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

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

I cannot even compile such a 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

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

The collected output of pgcc is :

How can I fix this?!

Thanks!!

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:

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