Pelles C forum

C language => Pocket PC and Smartphone questions => Topic started by: jasch212 on April 16, 2010, 10:25:58 AM

Title: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 16, 2010, 10:25:58 AM
hello,
next question:
how to link a program which uses:
system("notify") ;

how can i find the lib for this function?

thanks
Thomas
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: Stefan Pendl on April 16, 2010, 11:18:22 AM
Have you already tried to compile it?
What error did you get?
What libraries are already included?

I had never had to include a special library for standard functions.
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: JohnF on April 16, 2010, 11:58:49 AM
hello,
next question:
how to link a program which uses:
system("notify") ;

how can i find the lib for this function?

thanks
Thomas

Place the caret over the word 'system' then press F1, you should be presented with the PellesC help. Within the text you will see what header to include.

John
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 16, 2010, 12:29:11 PM
hi,
compile is OK, linking is the problem!
when I used the F1 key over:
system("notify") ;
I get the Help for system, but there is NO info about the lib I had to linked with my progrem.
Help:
Purpose:
Executes a system command.

I used following libs: (some systemLibs and some ownLibs for calculations:
aygshell.lib coredll.lib corelibc.lib geolib_ce.lib AviationFormularyLib.lib

Thomas
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: JohnF on April 16, 2010, 01:23:12 PM
'system' will compile and link without you needing to specify libs.

All you need to do is include the right header.

John
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: AlexN on April 16, 2010, 01:40:55 PM
Are you sure, that system is available for Pocket PC?

System starts an other program with cmd.exe, which does not exist on Windows Mobile. :(
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 16, 2010, 01:43:12 PM
F1 says:
Declared in:
<stdlib.h>

I included it (compile is OK)

linker:
POLINK: error: Unresolved external symbol 'system'.
POLINK: fatal error: 1 unresolved external(s).
*** Fehlercode: 1 ***
Fertig.

I used pelle 5.0

It seems that "system" is not implememted.
can I otherwise execute an external program?

Thomas
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: JohnF on April 16, 2010, 03:06:53 PM
linker:
POLINK: error: Unresolved external symbol 'system'.
POLINK: fatal error: 1 unresolved external(s).
*** Fehlercode: 1 ***
Fertig.

I used pelle 5.0

It seems that "system" is not implememted.
Thomas

It is implemented, there must be another problem somewhere. Can you post a small zipped project that shows the error?

John
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 16, 2010, 03:22:30 PM
ok,
I have build (via wizzard) a short TestProject, what i now see is an addtional warning:

Erzeugen von main.obj.
E:\ts\workspace\test\main.c(59): warning #2027: Missing prototype for 'system'.
Erzeugen von main.res.
Erzeugen von test.exe.
POLINK: error: Unresolved external symbol 'system'.
POLINK: fatal error: 1 unresolved external(s).
*** Fehlercode: 1 ***
Fertig.

Thomas
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: JohnF on April 16, 2010, 03:48:46 PM
Sorry, I can't test ARM things, maybe someone else can help.

Also, maybe system is not implemented on ARM, if that is the case I apologize.

John
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 16, 2010, 03:53:46 PM
ok,
thankyou JohnF,

does anyone know how to execute an external program on ARM?
or how to create a "beep" or littele sound on the loudspeaker.

Thomas
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: frankie on April 16, 2010, 05:06:54 PM
Use CreateProcess.
http://msdn.microsoft.com/en-us/library/ee488927.aspx (http://msdn.microsoft.com/en-us/library/ee488927.aspx)
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: TimoVJL on April 16, 2010, 06:54:22 PM
MessageBeep
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

int __cdecl WinMainCRTStartup(void)
{
MessageBeep(0);
ExitThread(0);
}
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <tchar.h>

void StartPrg(TCHAR *szModule, TCHAR *szCmdLine)
{
//STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
TCHAR szBuff[260];

//si.cb = sizeof(si);

// Start the child process.
if (!CreateProcess(szModule, // No module name (use command line)
szCmdLine, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
CREATE_NEW_CONSOLE, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
NULL, // Pointer to STARTUPINFO structure
&pi) // Pointer to PROCESS_INFORMATION structure
)
{
wsprintf(szBuff, L"CreateProcess failed (%d).\n", GetLastError());
MessageBox(0, szBuff, L"StartPrg", MB_OK);
return;
}
/*
    // Wait until child process exits.
    WaitForSingleObject( pi.hProcess, INFINITE );
*/
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);

}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
StartPrg(L"\\Windows\\calc.exe", NULL);
return 0;
}
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 16, 2010, 07:39:57 PM
hello all,

1. MessageBeep(0); compile and link OK but it doesn't work.

2. StartPrg(L"\\Windows\\calc.exe", NULL); compile and link OK it works!!!

3. but I want to here sound or a beep
if (!CreateProcess(L"\\windows\\sndply.exe",
            _T("\\windows\\notify.wav"),
            NULL,
            NULL,
            FALSE,
            0,
            NULL,
            NULL,
            NULL,
            &pi) )
compile and link OK but it doesn't work.
I have now a problem with sndply.exe or with the *.wav file

Thomas
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: TimoVJL on April 16, 2010, 08:28:21 PM
- L"\\windows\\sndplay.exe"
- Try to use that CREATE_NEW_CONSOLE
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 16, 2010, 08:46:11 PM
with the creation flag CREATE_NEW_CONSOLE
it also does'nt work.
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: TimoVJL on April 16, 2010, 09:04:06 PM
Is that sndplay.exe in \Windows folder ?
Can you run it ?

From Control Panel Volume & Sounds:
Is from Volume tab
 Enable sound for:
  Events (warning, beep and system events) checked ?

Tested with MIO C320b with Windows CE Core 5.0
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 17, 2010, 10:16:41 AM
hi,
I  thought  as  much,
I can open sndplay.exe in the \Windows folder.

But i here nothing when I create it from the program, thats the Problem.
CreateProcess(L"\\windows\\sndply.exe",
            L"\\windows\\notify.wav", ...

that doesn't work.

thanks
Thomas
Title: Re: POLINK: error: Unresolved external symbol 'system'.
Post by: jasch212 on April 17, 2010, 12:43:54 PM
ok I solved the Problem :)


I changed the registry
from: sndplay.exe %1
to: \Windows\sndplay.exe %1

I do not exactly why, but now it works!


thanks all for your answers
Thomas