Final Platform Layer » Forums » compiling a the minimal example of FPL on linux
albatros
8 posts

None

#15698 compiling a the minimal example of FPL on linux
1 month, 1 week ago Edited by albatros on July 4, 2018, 2:20 p.m. Reason: Initial post

Hello there, I'm trying out FPL on linux.

My main.c contains the basic example for window + opengl from the FPL file :
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#define FPL_IMPLEMENTATION
#include "final_platform_layer.h"

int main(int argc, char **args){
        fplSettings settings;
        fplSetDefaultSettings(&settings);
        fplVideoSettings videoSettings = settings.video;

        videoSettings.driver = fplVideoDriverType_OpenGL;

        // Legacy OpenGL                                                                                                                                                                       
        // videoSettings.opengl.compabilityFlags = fplOpenGLCompabilityFlags_Legacy;

        // or                                                                                                                                                                                  

        // Modern OpenGL                                                                                                                                                                       
        videoSettings.opengl.compabilityFlags = fplOpenGLCompabilityFlags_Core;
        videoSettings.opengl.majorVersion = 3;
        videoSettings.opengl.minorVersion = 3;

        if (fplPlatformInit(fplInitFlags_Video, &settings)) {
                // Event/Main loop                                                                                                                                                             
                while (fplWindowUpdate()) {
                        // Handle actual window events                                                                                                                                         
                        fplEvent ev;
                        while (fplPollEvent(ev)) {
                                /// ...                                                                                                                                                        
                        }

                        // your code goes here                                                                                                                                                 

                        fplVideoFlip();
                }
                fplPlatformRelease();
                return 0;
        } else {
                return -1;
        }
}


This is the command I use to compile :
1
gcc main.c -ldl && ./a.out 


Theses are the errors I get.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
main.c: In function ‘main’:
main.c:17:15: error: ‘fplVideoSettings {aka struct fplVideoSettings}’ has no member named ‘opengl’
  videoSettings.opengl.compabilityFlags = fplOpenGLCompabilityFlags_Core;
               ^
main.c:18:15: error: ‘fplVideoSettings {aka struct fplVideoSettings}’ has no member named ‘opengl’
  videoSettings.opengl.majorVersion = 3;
               ^
main.c:19:15: error: ‘fplVideoSettings {aka struct fplVideoSettings}’ has no member named ‘opengl’
  videoSettings.opengl.minorVersion = 3;
               ^
main.c:26:24: error: incompatible type for argument 1 of ‘fplPollEvent’
    while (fplPollEvent(ev)) {
                        ^
In file included from main.c:2:0:
final_platform_layer.h:7187:21: note: expected ‘fplEvent * {aka struct fplEvent *}’ but argument is of type ‘fplEvent {aka struct fplEvent}’
 fpl_common_api bool fplPollEvent(fplEvent *ev) {


I've got to admit, I have no clue on how to get past this. Any idea ?

None
ratchetfreak
382 posts
#15700 compiling a the minimal example of FPL on linux
1 month, 1 week ago

final_platform_layer.h:7187:21: note: expected ‘fplEvent * {aka struct fplEvent *}’ but argument is of type ‘fplEvent {aka struct fplEvent}’
fpl_common_api bool fplPollEvent(fplEvent *ev) {

means that the function wants a pointer but you passed a struct: fix by doing fplPollEvent(&ev) instead

fplVideoSettings doesn't have a member opengl, it does have a member graphics that has a opengl member: fix by replacing videoSettings.opengl with videoSettings.graphics.opengl
albatros
8 posts

None

#15704 compiling a the minimal example of FPL on linux
1 month, 1 week ago

Indeed, that worked ! :D
Many thanks !

None
Finalspace
114 posts / 1 project

I am finalspace and do programming since more than 25 years, started on C64 and got serious with borland delphi. Nowadays i use C/C++ only.

#15811 compiling a the minimal example of FPL on linux
4 weeks ago

I did a few api changes in the recent releases, so the documentation may be a little off.
The doxygen code sections will never get validated, so you never know if there is something wrong in the code snippets there :-(

So i will correct this in the next release.

But great that you got the problem solved ;)