app that runs in the background or is console-based

Forum thread started by Eva on Sun, 2011-01-02 06:32

(1) I am trying to find the source code for the system time shown in the Deskbar
since I am working on some app that should run in the background.

Anyone knows where this part of code is located in Haiku code tree?

***********************************************************************************

(2)
#include

int main()
{
printf("Test!");
return 0;
}

I got the following result:
/boot/develop/lib/x86/start_dyn.o: in function '_start':
start_dyn.c:(.text + 0x57): undefined reference to 'main'
collect2: ld returned 1 exit status

If I want to output something to the stdout, what should I write? Does it mean
that any app on Haiku has to be GUI-based? By the way I use Paladin as my IDE.

Comments

Re: app that runs in the background or is console-based

I'm not running Haiku at the moment, but I'm 100% certain that a simple snippet like:

#include <stdio.h>
 
int main(){
 
printf("Test!");
 
return 0;
}

would work with a g++ main.cpp (or gcc main.c etc) and executing a.out from terminal would print out 'Test!'

Re: app that runs in the background or is console-based

The code you've written should work just fine and will print something to stdout. The error you're getting is a linker error, and considering you've written a main() function, I'm puzzled why you're getting the error. Which project template did you use? Also, which revision and compiler build (gcc2, gcc4, hybrid) of Haiku are you using?

Re: app that runs in the background or is console-based

I tested that code and worked for me. I used Pe editor to write it.

My steps from terminal:
cd /boot/home, lpe simple.c, write the code in Pe & save, gcc simple.c, run a.out

No errors & works. Test that out to see if it works first. If yes, then you can try again with Paladin.

Re: app that runs in the background or is console-based

same problem but solved

Re: app that runs in the background or is console-based

same problem but solved