C++ program only runable on FreeBSD?

Hi, first of all, im the new one :)
so here my question.... is it posible to check, wich os try to run a c++ programm, and stop it?

I'm pretty new on c++ developing... but i dont want, that my program can run on Windows or Linux

Any ideas?

Kind regards
Sada
 
Well a windows executable isn't going to work on FreeBSD and vice versa so I don't see an issue there.

I don't think Linux has a FreeBSD compatibility shim, so an executable compiled for FreeBSD can't work against a Linux kernel because the calling mechanism is different.
 
tobik@
Why not?? :)
Well i'm verry new in c++ and i just asked me, is it posible? ^^

leebrown66
So, when i compile the code on a (Free)BSD Compiler, i'll cant use it cross to Linux??

Whats about Development?
Can i develope the code on Linux in same way and just compile on bsd?
Are there different libs (headers) i have to use??

Like <iostream> or <fstream> and so on?? Or different Syntax?

Like i said.... i'm verry new on c++
 
If you compile a program on FreeBSD, no you can't copy the executable and run it under Linux (or Windows).

However you can copy the source to Linux and compile under Linux. That executable will only run on Linux.
Provided you are using standard stuff, the libraries and headers are named the same, no change to code is needed. Ditto for windows.

So absolutely yes, you can develop on Linux, then when you are happy, copy the source over to FreeBSD and compile it there.
 
These libraries are standardized so as long as your syntax and compiler are standard-compliant, you'll be fine.

Higher-level libraries such as Qt have also been ported to all major operating systems, so no problem there either.

If you want to develop under GNU/Linux you should avoid Linuxisms though.
 
Back
Top