Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
76 user(s) are online (61 user(s) are browsing Forums)

Members: 1
Guests: 75

Joeled, more...

Support us!

Headlines

Report message:*
 

Re: Porting to AmigaOS4 thread

Subject: Re: Porting to AmigaOS4 thread
by Raziel on 2021/1/2 12:44:53

And again noob help please.

I was trying out a simple image display (SDL2) program of a few lines in size.

After fixing all the comnpilation errors i'm stuck at one.

#include <iostream>

This file is not found by the compiler
Quote:

gcc -c -o Img_SDL.o Img_SDL.c
In file included from Img_SDL.c:2:
iostream.h:2:10: fatal error: iostream: No such file or directory
2 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
gmake: *** [Img_SDL.o] Error 1


The file itself resides in SDK:gcc/include/c++/9.1.0/iostream, so i guess it's a missing path or assing somewhere, but shouldn't the ones that are placed by the SDK installer be sufficient?

Here's the example code (yes, it's the - slightly adapted - SDL image display example, need it to test something else)
#include <stdlib.h>
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>

int main(int argccharargv[]) {
    
using namespace std;
    if (
SDL_Init(SDL_INIT_VIDEO SDL_INIT_EVENTS) < 0) {
        
cout << "Error SDL2 Initialization : " << SDL_GetError();
        return 
1;
    }
        
    if (
IMG_Init(IMG_INIT_PNG) == 0) {
        
cout << "Error SDL2_image Initialization";
        return 
2;
    }

    
SDL_Windowwindow SDL_CreateWindow("First program"SDL_WINDOWPOS_CENTEREDSDL_WINDOWPOS_CENTERED800600SDL_WINDOW_OPENGL);
    if (
window == NULL) {
        
cout << "Error window creation";
        return 
3;
    }

    
SDL_Rendererrenderer SDL_CreateRenderer(window, -1SDL_RENDERER_ACCELERATED);
    if (
renderer == NULL) {
        
cout << "Error renderer creation";
        return 
4;
    }

    
SDL_Surfacelettuce_sur IMG_Load("lettuce.png");
    if (
lettuce_sur == NULL) {
        
cout << "Error loading image: " << IMG_GetError();
        return 
5;
    }

    
SDL_Texturelettuce_tex SDL_CreateTextureFromSurface(rendererlettuce_sur);
    if (
lettuce_tex == NULL) {
        
cout << "Error creating texture";
        return 
6;
    }

    
SDL_FreeSurface(lettuce_sur);

    while (
true) {
        
SDL_Event e;
        if (
SDL_PollEvent(&e)) {
            if (
e.type == SDL_QUIT) {
                break;
            }
        }

        
SDL_RenderClear(renderer);
        
SDL_RenderCopy(rendererlettuce_texNULLNULL);
        
SDL_RenderPresent(renderer);
    }

    
SDL_DestroyTexture(lettuce_tex);
    
SDL_DestroyRenderer(renderer);
    
SDL_DestroyWindow(window);
    
IMG_Quit();
    
SDL_Quit();

    return 
0;
}


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project