Author Topic: Need help for CB setup under Linux (c++ programming with SDK)  (Read 2237 times)

Offline SchneiH2

  • Single posting newcomer
  • *
  • Posts: 2
Need help for CB setup under Linux (c++ programming with SDK)
« on: August 31, 2021, 02:14:25 pm »
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:
Quote
Linking 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

Online stahta01

  • Lives here!
  • ****
  • Posts: 7192
    • My Best Post
Re: Need help for CB setup under Linux (c++ programming with SDK)
« Reply #1 on: September 01, 2021, 01:01:17 am »
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++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline SchneiH2

  • Single posting newcomer
  • *
  • Posts: 2
Re: Need help for CB setup under Linux (c++ programming with SDK)
« Reply #2 on: September 01, 2021, 09:03:44 am »
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

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 837
Re: Need help for CB setup under Linux (c++ programming with SDK)
« Reply #3 on: September 01, 2021, 02:19:30 pm »
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.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7192
    • My Best Post
Re: Need help for CB setup under Linux (c++ programming with SDK)
« Reply #4 on: September 01, 2021, 03:01:00 pm »
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++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7192
    • My Best Post
Re: Need help for CB setup under Linux (c++ programming with SDK)
« Reply #5 on: September 01, 2021, 03:39:04 pm »
Code
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.
« Last Edit: September 01, 2021, 03:43:50 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org