User forums > Using Code::Blocks
winapi under linux
Samuel G.:
I have read anything about cross compiling now. 2 general questions:
1. The first thing would be to know, if I can prevent codeblocks/gcc to automatically include /usr/include/ even if it is not in the search directories list.
2. I guess the only difference between compiling for a pc running Windows and one running Linux is inclusion of the correct headers and libraries. Is this right?
Jenna:
--- Quote from: Samuel G. on June 16, 2010, 10:52:36 pm ---I have read anything about cross compiling now. 2 general questions:
1. The first thing would be to know, if I can prevent codeblocks/gcc to automatically include /usr/include/ even if it is not in the search directories list.
2. I guess the only difference between compiling for a pc running Windows and one running Linux is inclusion of the correct headers and libraries. Is this right?
--- End quote ---
You obviously did either not read anything about cross-compiling or you did not understand what it means.
1. no need to, use i586-mingw32msvc-gcc (or something similar) instead, packages exist for most major distros as far as I know,
2. no
Read this carefully: http://forums.codeblocks.org/index.php/topic,3343.0.html
and especially if you want to use wxwidgets in cross-compiling read this wiki article:
http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux
and this thread: http://forums.codeblocks.org/index.php/topic,7978.0.html
Samuel G.:
Thank you for your patience.
I think I got it now.
One more thing on question 1.: So a the compilers executable automatically searches for standard headers to include in ./../include?
Therefore when installing MinGW one has to add ./../i586-mingw32msvc/include to the "Search Directories" List. I am quite sceptic about this behavior. How does the compiler know, that this headers should replace the standard library headers that it otherwise would expect to be at ./../include/, and not include both of them?
Please excuse that I am insisting on this point. I am just asking to get a more profound understanding, not to go on anyones nerves.
I installed mingw. And I managed to get rid of the library conflicts... At last I am able to compile my project using mingw now.
3. What do I have to do to make it produce a .dll file? Is it enough to rename the output filename to *.dll instead of *.exe? But still it does not produce a .lib file then... How to do that?
kencamargo:
--- Quote from: Samuel G. on June 18, 2010, 01:06:48 am ---Therefore when installing MinGW one has to add ./../i586-mingw32msvc/include to the "Search Directories" List. I am quite sceptic about this behavior. How does the compiler know, that this headers should replace the standard library headers that it otherwise would expect to be at ./../include/, and not include both of them?
--- End quote ---
Read carefully the instructions, everything you need is there. This kind of setting is handled by wx-config, see the item under the heading "Fixing build options" in http://wiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux, as already recommended.
--- Quote ---3. What do I have to do to make it produce a .dll file? Is it enough to rename the output filename to *.dll instead of *.exe? But still it does not produce a .lib file then... How to do that?
--- End quote ---
Start your project as a shared library.
Samuel G.:
3. Sorry, *.dll, instead of *.so, I mean. My Project is a shared library project, but still mingw-gcc only outputs a .dll, but no .lib file.
This are the command line options:
--- Quote ----------------- Build: Debug in sgCommon ---------------
i586-mingw32msvc-g++ -shared -L/usr/i586-mingw32msvc/lib obj/Windows/Debug/Source/UnitGlobal.o obj/Windows/Debug/Source/UnitManager.o obj/Windows/Debug/Source/UnitSGCommon.o obj/Windows/Debug/Source/UnitTimer.o obj/Windows/Debug/sgDataStructure/Source/UnitGlobal.o obj/Windows/Debug/sgDataStructure/Source/UnitList.o obj/Windows/Debug/sgDataStructure/Source/UnitListBase.o obj/Windows/Debug/sgDataStructure/Source/UnitListElement.o obj/Windows/Debug/sgDataStructure/Source/UnitListElementPointer.o obj/Windows/Debug/sgDataStructure/Source/UnitPointerList.o obj/Windows/Debug/sgDataStructure/Source/UnitPointerListBase.o obj/Windows/Debug/sgDataStructure/Source/UnitPointerTree.o obj/Windows/Debug/sgDataStructure/Source/UnitPointerTreeBase.o obj/Windows/Debug/sgDataStructure/Source/UnitPointerTreeElement.o obj/Windows/Debug/sgDataStructure/Source/UnitSGDataStructure.o obj/Windows/Debug/sgDataStructure/Source/UnitTree.o obj/Windows/Debug/sgDataStructure/Source/UnitTreeBase.o obj/Windows/Debug/sgDataStructure/Source/UnitTreeElement.o obj/Windows/Debug/sgException/Source/UnitException.o obj/Windows/Debug/sgException/Source/UnitGlobal.o obj/Windows/Debug/sgException/Source/UnitSGException.o obj/Windows/Debug/sgException/Source/UnitTextException.o obj/Windows/Debug/sgException/Source/UnitTypeException.o obj/Windows/Debug/sgGlobal/Source/UnitGlobal.o obj/Windows/Debug/sgGlobal/Source/UnitPreprocessor.o obj/Windows/Debug/sgGlobal/Source/UnitSGGlobal.o obj/Windows/Debug/sgGlobal/Source/UnitTemplateAbstraction.o obj/Windows/Debug/sgGlobal/Source/UnitWrapper.o obj/Windows/Debug/sgMath/Source/UnitGlobal.o obj/Windows/Debug/sgMath/Source/UnitMath.o obj/Windows/Debug/sgMath/Source/UnitNumber.o obj/Windows/Debug/sgMath/Source/UnitSGMath.o obj/Windows/Debug/sgMemory/Source/UnitAutoPointer.o obj/Windows/Debug/sgMemory/Source/UnitGlobal.o obj/Windows/Debug/sgMemory/Source/UnitMemory.o obj/Windows/Debug/sgMemory/Source/UnitMemoryFunctions.o obj/Windows/Debug/sgMemory/Source/UnitMemoryManager.o obj/Windows/Debug/sgMemory/Source/UnitSGMemory.o obj/Windows/Debug/sgStream/Source/UnitFile.o obj/Windows/Debug/sgStream/Source/UnitGlobal.o obj/Windows/Debug/sgStream/Source/UnitInFile.o obj/Windows/Debug/sgStream/Source/UnitInStream.o obj/Windows/Debug/sgStream/Source/UnitMessageBox.o obj/Windows/Debug/sgStream/Source/UnitOutFile.o obj/Windows/Debug/sgStream/Source/UnitOutStream.o obj/Windows/Debug/sgStream/Source/UnitReport.o obj/Windows/Debug/sgStream/Source/UnitReportFile.o obj/Windows/Debug/sgStream/Source/UnitReportFunctions.o obj/Windows/Debug/sgStream/Source/UnitReportManager.o obj/Windows/Debug/sgStream/Source/UnitReportMessageBox.o obj/Windows/Debug/sgStream/Source/UnitReportStream.o obj/Windows/Debug/sgStream/Source/UnitReportStreamManager.o obj/Windows/Debug/sgStream/Source/UnitSGStream.o obj/Windows/Debug/sgStream/Source/UnitStream.o obj/Windows/Debug/sgStream/Source/UnitStreamManager.o obj/Windows/Debug/sgString/Source/UnitGlobal.o obj/Windows/Debug/sgString/Source/UnitSGString.o obj/Windows/Debug/sgString/Source/UnitString.o obj/Windows/Debug/sgString/Source/UnitStringFunctions.o obj/Windows/Debug/sgTypes/Source/UnitGlobal.o obj/Windows/Debug/sgTypes/Source/UnitListHeterogeneous.o obj/Windows/Debug/sgTypes/Source/UnitListType.o obj/Windows/Debug/sgTypes/Source/UnitSGTypes.o obj/Windows/Debug/sgTypes/Source/UnitTypeTraits.o -o Bin/Debug/sgCommon.dll -lstdc++ -lwinmm
Output size is 4,14 MB
Running target post-build steps
cp --preserve=timestamps Bin/Debug//libsgCommon.a Bin/Debug//../Lib/libsgCommon.a
cp: Aufruf von stat für „Bin/Debug//libsgCommon.a“ nicht möglich: No such file or directory
Process terminated with status 1 (0 minutes, 2 seconds)
0 errors, 0 warnings
--- End quote ---
The article you mentioned is good. Everything is configured as described there. The wxWidgets settings don't help me, because I don't use wxWidgets in this project.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version