Author Topic: [just installed, problems to compile]  (Read 17431 times)

ecare

  • Guest
[just installed, problems to compile]
« on: September 12, 2007, 07:06:27 pm »
Bonjour,

I've just downloaded code::block,
it works fine to open a file.c and for writing over the code but it doesn't compile!

here is what I get...

Compiling: serveur.c
serveur.c:5:24: sys/socket.h: No such file or directory
serveur.c:7:24: netinet/in.h: No such file or directory
serveur.c:8:19: netdn.h: No such file or directory
serveur.c:10: error: variable `sockaddr_in sin' has initializer but incomplete type
serveur.c:10: error: `AF_INET' was not declared in this scope
serveur.c:12: error: expected `,' or `;' before "void"
serveur.c:55:3: warning: no newline at end of file
serveur.c:10: error: storage size of `sin' isn't known
Process terminated with status 1 (0 minutes, 0 seconds)
7 errors, 1 warnings
 
I run two O.S. and with ubuntu no problems but my laptop is XP and it does not work!
So you see compiling does not recognize librairies that gcc do
And errors appears

PLEASE HELP!

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Re: [just installed, problems to compile]
« Reply #1 on: September 12, 2007, 07:25:34 pm »
Edit: Ok this is wrong, sorry.
Seems you don't have MinGW on your system, make sure you have it, and also that Code::Blocks is looking in the right place.
"Settings" -> "Compiler and debugger settings" -> "Toolchain Executables" check that is pointing to your MinGW directory.

You may find more info in the CB wiki:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_nightly_build_on_Windows
http://wiki.codeblocks.org/index.php?title=MinGW_installation

Regards, XayC
« Last Edit: September 12, 2007, 08:23:14 pm by XayC »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: [just installed, problems to compile]
« Reply #2 on: September 12, 2007, 07:46:34 pm »
serveur.c:5:24: sys/socket.h: No such file or directory
serveur.c:7:24: netinet/in.h: No such file or directory
serveur.c:8:19: netdn.h: No such file or directory
Those files are *not* part of the MinGW package. They implement unix/berekley sockets which has not been ported. You now have the following options:
1.) Use Cygwin API - unix sockets are available in this environment but then you will depend on the Cygwin layer (DLL).
2.) Use Windows sockets (WinAPI) but you have to modify the code heavily.
3.) Use another socket implementation that is capable of providing unix sockets (emulation) on Windows. Google for such.

With regards, Morten.
« Last Edit: September 13, 2007, 07:51:48 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

ecare

  • Guest
Re: [just installed, problems to compile]
« Reply #3 on: September 16, 2007, 10:00:09 pm »
bonjour,
thanks for your help Morten and XayC!!!

I'll try and get back to you...

bye

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: [just installed, problems to compile]
« Reply #4 on: September 16, 2007, 10:53:28 pm »
Perhaps you want to give the wxWidgets socket implementation a try? It should work on Win and on linux.
I would be interested in experience with this class, because I have to write a server/client to communicate between a web-application and several Beckhoff Bus Terminal Controllers over Tcp/Ip .

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: [just installed, problems to compile]
« Reply #5 on: September 16, 2007, 11:39:41 pm »
Windows and *nix sockets are quite similar. You just need to include the right header files and link against the right libraries for each platform. Oh, you also need to initialize and destroy a special type of variable in Windows.

If you want, you can use and/or check an implementation I made that works in both Windows and *nix with an interface similar to that provided by wxWidgets. Just go here, click on BattleCS, then Utils, and, finally, socket.hpp.