gotlium/madfish-webtoolkit

Compiling on CodeBlocks (MinGW) under Windows

GoogleCodeExporter opened this issue · 5 comments

What steps will reproduce the problem?
1. Add all files to emptu progect.
2. Try compile HelloWorld example.
3.

What is the expected output? What do you see instead?
See many error messages:
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x7d)|
|undefined
reference to `_select@20'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x8e)|
|undefined
reference to `___WSAFDIsSet@8'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x130)
||undefined
reference to `_send@16'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x340)
||undefined
reference to `_recv@16'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x545)
||undefined
reference to `_closesocket@4'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x685)
||undefined
reference to `_closesocket@4'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0xa84)
||undefined
reference to `_socket@12'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0xae2)
||undefined
reference to `_setsockopt@20'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0xb04)
||undefined
reference to `_htons@4'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0xb18)
||undefined
reference to `_inet_addr@4'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0xb3e)
||undefined
reference to `_bind@12'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0xb6d)
||undefined
reference to `_listen@8'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x10c4
)||undefined
reference to `_socket@12'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x1122
)||undefined
reference to `_setsockopt@20'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x1144
)||undefined
reference to `_htons@4'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x1158
)||undefined
reference to `_inet_addr@4'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x117e
)||undefined
reference to `_bind@12'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x11ad
)||undefined
reference to `_listen@8'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x188d
)||undefined
reference to `_accept@12'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x1906
)||undefined
reference to `_inet_ntoa@4'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x1ba9
)||undefined
reference to `_WSAStartup@8'|
obj\Release\madfish-webtoolkit-1.1\CoreToolkit\Socket.o:Socket.cpp:(.text+0x1bc1
)||undefined
reference to `_WSACleanup@0'|
||=== Build finished: 22 errors, 15 warnings ===|


What version of the product are you using? On what operating system?
OS: Windows 2003SP2, CodeBlocks 8.02 with MinGW

Please provide any additional information below.


Original issue reported on code.google.com by Mikhail....@gmail.com on 18 Sep 2009 at 4:50

You're missing linker dependencies this way (winsock).
You should generate CodeBlocks project files with cmake instead.

Run this from your build directory
cmake -G "CodeBlocks - Unix Makefiles" path\to\sources

Original comment by madfisht...@gmail.com on 18 Sep 2009 at 8:42

  • Changed state: Invalid
Now cmake unable to find some environment variables.
How I can quickly configure all environment variables? (Maybe exist's plugin for
CodeBlock's)


cmake -G "CodeBlocks - Unix Makefiles" path\to\sources
C:\webtool>cmake -G "CodeBlocks - Unix Makefiles" 11
CMake Error: CMake was unable to find a build program corresponding to "Unix Mak
efiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a differen
t build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be
 built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be
 built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:C:/webtool/CMakeFiles/CMakeCCompil
er.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be
 built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be
 built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:C:/webtool/CMakeFiles/CMakeCXXComp
iler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

Original comment by Mikhail....@gmail.com on 18 Sep 2009 at 9:50

Use "CodeBlocks - Unix Makefiles" if you have MinGW+MSYS installed.
Use "CodeBlocks - MinGW Makefiles" if you have only MinGW.

I have this in my path: "C:\MinGW\bin;C:\msys\1.0\bin;C:\Program Files\CMake 
2.6\bin"

Assuming sources are in C:\WebApps, and current dir is C:\, commands will be:
mkdir WebAppsCodeBlocks
cd WebAppsCodeBlocks
cmake -G "CodeBlocks - Unix Makefiles" ..\WebApps

Now you have WebApps.cbp in C:\WebAppsCodeBlocks\

You should really get familiar with cmake, it's very useful build tool.


Original comment by madfisht...@gmail.com on 19 Sep 2009 at 9:25

Thanks, adding in PATH environment variable path to MinGW help me.

Maybe usefull step by step instruction for another users:

1) Install CMAKE
http://www.cmake.org/
2) add in the PATH environment variable path to MinGW
C:\Program Files\CMake 2.6\bin;c:\Program Files\CodeBlocks\MinGW\bin
3) On the C drive, create a folder WebApps and transfer the contents of the 
archive there
4) Create there subfolder CodeBlocks and go into
5) At the command prompt, Total Commander (we're not enemies themselves) are
launching the console cmd
6) In the shell and enter the command cmake -G "CodeBlocks - MinGW Makefiles"
..\..\WebApps

If done correctly in the folder CodeBlocks would contain CodeBlocks progect, 
which
can already open in the IDE and build. 

Original comment by Mikhail....@gmail.com on 19 Sep 2009 at 10:31

I've already written some basic instructions for compiling here:
http://code.google.com/p/madfish-webtoolkit/wiki/CompilingFromSource

It's not practical to describe all possible build situations there.
For more details users should refer to the cmake documentation.

Original comment by madfisht...@gmail.com on 19 Sep 2009 at 12:37