User forums > Using Code::Blocks
winapi under linux
Samuel G.:
Hello,
I am using CodeBlocks in a Ubuntu. However, I want to be able to compile windows libraries/applications. Therefore I downloaded the windows api from this source:
http://sunet.dl.sourceforge.net/project/mingw/MinGW/BaseSystem/RuntimeLibrary/Win32-API/w32api-3.14/w32api-3.14-mingw32-dev.tar.gz
I extracted the archive to a folder, I created, and added <myfolder>/include to the "Search Directories" in Settings->Compiler and Debugger...
Now, when I am compiling a file including <windows.h>, i get the following errors:
/usr/include/bits/time.h|69|error: redefinition of ‘struct timeval’|
/data/Programmierung/WinAPI/include/winsock2.h|109|error: previous definition of ‘struct timeval’|
/usr/include/sys/select.h|78|error: conflicting declaration ‘typedef struct fd_set fd_set’|
/data/Programmierung/WinAPI/include/winsock2.h|64|error: ‘fd_set’ has a previous declaration as ‘typedef struct fd_set fd_set’|
/usr/include/sys/select.h|112|error: declaration of C function ‘int select(int, fd_set*, fd_set*, fd_set*, timeval*)’ conflicts with|
/data/Programmierung/WinAPI/include/winsock2.h|632|error: previous declaration ‘int select(int, fd_set*, fd_set*, fd_set*, const timeval*)’ here|
||=== Build finished: 6 errors, 0 warnings ===|
I guess this is a general problem, with a common solution. Even though I can't solve it, because I do not understand it in depth. I think the errors mean, that the standard library somehow is dependent on the api of the operating system. Does this mean that I have to install a different version of the c++ standard library for every platform I want to compile for?
Nice Greetings
sg
Ceniza:
Search for "cross compiler" in Google. That should give you plenty of answers and ways to proceed. There have been some threads here mentioning it as well, so it may be a good search for this forum as well.
Samuel G.:
thanks for your quick reply.
Next Question: Why don't I have to manually set a search path for the standard library if I use gcc? Codeblocks seems to know that it is placed under /usr/include/. But how?
Samuel G.:
I have read much about cross compiling and stuff. My Problem remains the same.
How can I avoid redefinition of the symbols? What is the reason for it?
This question is not answered by any explanation on cross compiling I read.
stahta01:
http://forums.codeblocks.org/index.php/topic,8962.0.html
http://wiki.codeblocks.org/index.php?title=Code::Blocks_and_Cross_Compilers
http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux
http://forums.codeblocks.org/index.php/topic,3343.0.html
Navigation
[0] Message Index
[#] Next page
Go to full version