News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Need help for CB setup under Linux (c++ programming with SDK)

Started by SchneiH2, August 31, 2021, 02:14:25 PM

Previous topic - Next topic

SchneiH2

Hi everybody
I have started to (partly) use CB (for plugin development for flight sim XPlane based on its SDK) under Linux (Mint) instead of W10. With some help I could get the SDK with CB running under W10, however, so far I could not manage to get this working under Linux and would be very grateful for some help.

The basic settings I made under W10 are as follows:

for the compiler:
Preferences-Compiler-Linker settings-Link libraries: link to the SDK lib directory
Preferences-Compiler-Linker settings-Other linker options: -lopengl32 (as the plugin uses openGL)
Preferences-Compiler-Search directories-Compiler: link to the SDK headers directories
Preferences-Compiler-Search directories-Linker: link to the SDK headers directories
Preferences-Compiler-Compiler settings-#includes: some variables (IBM=1, XSDK301=1 etc.)

for the project:
Project-Properties-Build targets-Release: DLL

All other (standard) settings of CB are left unchanged

For CB under Linux I have basically used the same settings understanding that there are some differences, e.g. no need of dll-paths.
For test purposes under Linux the SDK provides some ready project(s) containing a cpp-file and a make-file. Need to admit that I am not familiar enough with IDEs/programming to understand the correct use of a make file.

With CB under Linux I have created an empty project and added the content of the cpp-file. Further settings of CB are made as described above except for the dll-paths. The SDK tutorial/instructions for linking under Linux are as follows:
QuoteLinking on Linux
There are no link libraries on Linux for the SDK; instead pass the command-line option
-shared -rdynamic -nodefaultlibs -undefined_warning
to the linker. This will let you link despite not having XPLM symbols defined. To include libraries like OpenGL use this:
-lGL -lGLU

Frankly speaking I am not sure where to put the shown command-line option in CB (for Linux). Putting this under Preferences-Compiler-Linker settings-Other linker options does not compile without errors not saying that this is the reason. Perhaps there are some other missing/wrong settings in CB.

Thanks up-front for any help

SHJ

stahta01

Please explain why you did not post the error or a full build log?
Without at least one of those all you are going to get are guesses.
You might get a educated guess; me I am a windows person so, I can not even do a good guess.

Note: A link to the project you are trying to compile would also help.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

SchneiH2

Thank you very much for the quick reply.

The buildlog is in the attachement. I did not alter the code and thus I am quite sure that the error messages are somehow related to the IDE setup. BTW I remember that when setting up CB under W10 there were similar error messages which looked like some errors in the code.
The project can be downloaded here: https://developer.x-plane.com/code-sample/hello-world-sdk-3/ (the download links for the different OS are under the picture)

Thanks in advance for further help.

SHJ

Miguel Gimenez

The error messages suggests you have missed some include file, probably XPLMDisplay.h . The link stage has not started yet.

Regarding the linker options, you should put them in Project -> Build options -> Linker settings -> Other linker options. The openGL libraries should go in the Link libraries control; their names depend on your distro, and you must install the development versions beforehand.

As a general rule you shouldn't edit Preferences -> Compiler but Project -> Build options -> Compiler settings.

stahta01

I looked at the code less than 5 minutes.

My guess is "IBM" means Windows and "LIN" means Linux.

Instead of IBM=1 I would try LIN=1

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01


INCLUDES = \
-I$(SRC_BASE)/SDK/CHeaders/XPLM \
-I$(SRC_BASE)/SDK/CHeaders/Widgets

DEFINES = -DXPLM200=1 -DXPLM210=1 -DXPLM300=1 -DXPLM301=1 -DXPLM302=1 -DXPLM303=1 -DAPL=0 -DIBM=0 -DLIN=1


The makefile for Linux had the above it it.

Edit: Looks like you must define XPLM200 to 1 to fix the compiler error; me I would also at least define IBM to 0 to be safe on next try.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]