I don't get any int return warnings, the only output from compilation is:
Info: resolving _CRT_MT by linking to __imp__CRT_MT (auto-import)
which has something to do with multi-threading, I believe. Below is
almost the exact code that worked yesterday morning (I unfortunately
don't have an exact copy of the code that worked), before I started to
complicate things. If I comment out the execv(), everything else works.
I have tested the lame.exe by itself, and it works, too. I am
compiling with arm-wince-cegcc-gcc and then copying to Windows Mobile 5.
// Begin Code
#include <windows.h>
#include <stdio.h>
#include <process.h>
#define TEST_WAV_FILE "horse.wav"
#define TEST_MP3_OUT "test.mp3"
#define LAME_EXECUTABLE "lame.exe"
#define ERROR_LOG_FILE "log.txt"
int encode()
{
FILE *logFile = fopen(ERROR_LOG_FILE, "a+");
if(logFile == NULL){
MessageBoxW(0, L"Failed to open log.txt", L"Log File failure", 0);
exit(1);
}
fprintf(logFile, "BEGIN: log file opened.\n");
FILE *lame = fopen(LAME_EXECUTABLE, "r");
if(lame == NULL){
fprintf(logFile, "Couldn't read %s\n", LAME_EXECUTABLE);
exit(1);
}
fclose(lame);
fprintf(logFile, "Successfully read lame executable.\n");
fprintf(logFile, "Encoding file %s\n", TEST_WAV_FILE);
char *args[3];
args[0] = LAME_EXECUTABLE;
args[1] = TEST_WAV_FILE;
args[2] = TEST_MP3_OUT;
execv(LAME_EXECUTABLE, args);
fprintf(logFile, "END: finished encoding all files.\n");
fclose(logFile);
MessageBoxW(0, L"Execution completed successfully.", L"Execution
Complete", 0);
return 0;
}
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR
lpCmdLine, int nCmdShow)
{
encode();
return 0;
}
// End Code
I'm going to try to enable the exception handling, but I believe I am
using version .14 of cegcc, so it could be interesting...
Thanks again,
Matt
Pedro Alves wrote:
> Ximsce wrote:
>> Possibly, I'm not using MSVC, just the arm-wince-cegcc-gcc by itself to
>> cross-compile on a linux box and then transfer the app to an iPaq
>> running Windows Mobile 5. I'll look into the initialization routines
>> and see if I can change something there, but honestly I've reverted the
>> app back to a form that was working yesterday morning, and I can follow
>> that to a crash as soon as it hits one of the methods I mentioned
>> previously. I'll keep looking for typos, but one thing I've noticed is
>> that even if I don't explicitly include libraries like <string.h>, the
>> program compiles with methods that should be included from this library,
>> anyway. Perhaps that is a clue?
>>
>
> What could happen is that you're passing wrong parameters into one of those
> functions. Since you didn't include the header that declares them, the
> compiler
> couldn't warn you about it. Instead, it normally warns you about
> "return type defaulting to int". Include every header needed and fix
> your code
> until those warnings go away.
>
> We can't help much further without a minimal compilable and
> runnable example. Many times, when one tries to reduce the app
> trying to figure out what is it that's breaking it, one finds the problem.
>
> Cheers,
> Pedro Alves
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cegcc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cegcc-devel