Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

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

Members: 0
Guests: 123

more...

Headlines

 
  Register To Post  

(Noob) compiling/linking and anything else questions
Home away from home
Home away from home


See User information
Help...


I already shifted around the libraries of SDL_image, but it seems to be something else i'm missing, probably something to do with -lsmpeg, because if i leave that one out i only get error message about smpeg missing, but none else.
So, what am i missing here?

gmake -f Makefile_amigaos4 
g
++ -athread=native -Wl,--no-keep-memory -L/sdk/local/newlib/lib -o D20_amigaos4 Dice.o EquipScreen.o Game.o Graphics.o Inventory.o Items.o MainGame.o MapEditor.o Money.o Screen.o SelectionScreen.o ShopScreen.o Sprites.o startScreen.o utilities.`sdl-config --static-libs` -lSDL -lSDL_ttf -lfreetype -lSDL_image -ltiff -ljpeg -lpng -lwebp -lSDL_mixer -lvorbisfile -lvorbis -logg -lflac -lsmpeg -lmikmod -lmodplug -lpthread -lz
/SDK/local/newlib/lib/libSDL_mixer.a(mixer.o): In function `Mix_LoadWAV_RW':
/home/salass00/Development/Projects/Libraries/SDL_mixer-1.2.12/mixer.c:588: undefined reference to 
`SDL_LoadWAV_RW'
/SDK/local/newlib/lib/libSDL_mixer.a(mixer.o): In function `mix_channels'
:
/
home/salass00/Development/Projects/Libraries/SDL_mixer-1.2.12/mixer.c:345undefined reference to `SDL_MixAudio'
/home/salass00/Development/Projects/Libraries/SDL_mixer-1.2.12/mixer.c:369: undefined reference to 
`SDL_MixAudio'
/SDK/local/newlib/lib/libSDL_mixer.a(wavestream.o): In function `WAVStream_PlaySome'
:
/
home/salass00/Development/Projects/Libraries/SDL_mixer-1.2.12/wavestream.c:210undefined reference to `SDL_MixAudio'
/home/salass00/Development/Projects/Libraries/SDL_mixer-1.2.12/wavestream.c:221: undefined reference to 
`SDL_MixAudio'
/SDK/local/newlib/lib/libSDL_mixer.a(music_ogg.o): In function `OGG_playAudio'
:
/
home/salass00/Development/Projects/Libraries/SDL_mixer-1.2.12/music_ogg.c:191undefined reference to `SDL_MixAudio'
/SDK/local/newlib/lib/libSDL_mixer.a(music_flac.o):/home/salass00/Development/Projects/Libraries/SDL_mixer-1.2.12/music_flac.c:512: more undefined references to 
`SDL_MixAudio' follow
/SDK/local/newlib/lib/libsmpeg.a(MPEGvideo.o): In function `MPEGvideo::SetDisplayRegion(int, int, int, int)'
:
/
Work/smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp:503undefined reference to `SDL_FreeYUVOverlay'
/Work/smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp:504: undefined reference to 
`SDL_CreateYUVOverlay'
/SDK/local/newlib/lib/libsmpeg.a(MPEGvideo.o): In function `MPEGvideo::SetDisplay(SDL_Surface*, SDL_mutex*, void (*)(SDL_Surface*, int, int, unsigned int, unsigned int))'
:
/
Work/smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp:438undefined reference to `SDL_FreeYUVOverlay'
/Work/smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp:440: undefined reference to 
`SDL_CreateYUVOverlay'
/SDK/local/newlib/lib/libsmpeg.a(MPEGvideo.o): In function `~MPEGvideo'
:
/
Work/smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp:222undefined reference to `SDL_FreeYUVOverlay'
/Work/smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp:222: undefined reference to 
`SDL_FreeYUVOverlay'
/Work/smpeg-0.4.5+cvs20030824.orig/video/MPEGvideo.cpp:222: undefined reference to `SDL_FreeYUVOverlay'
/SDK/local/newlib/lib/libsmpeg.a(gdith.o): In function `MPEGvideo::DisplayFrame(vid_stream*)':
/Work/smpeg-0.4.5+cvs20030824.orig/video/gdith.cpp:292: undefined reference to 
`SDL_LockYUVOverlay'
/Work/smpeg-0.4.5+cvs20030824.orig/video/gdith.cpp:354: undefined reference to `SDL_DisplayYUVOverlay'
/Work/smpeg-0.4.5+cvs20030824.orig/video/gdith.cpp:359undefined reference to `SDL_UnlockYUVOverlay'
gmake: *** [D20_amigaos4] Error 1

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: (Noob) compiling/linking and anything else questions
Just can't stay away
Just can't stay away


See User information
@Raziel

Move -lSDL so that it comes after -lSDL_mixer and -lsmpeg (I would suggest just before -lpthread).

Go to top
Re: (Noob) compiling/linking and anything else questions
Home away from home
Home away from home


See User information
@salass00

Thank you

That worked, but why?
In every other port i tried (not that much, but still) -lSDL has to be on the first position or else some stuff in the code won't use SDL.

btw: Using -lsmpeg2 still don't work (but i'm not sure if -lsmpeg2 is just an update to -lsmpeg or meant to be used with SDL2

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: (Noob) compiling/linking and anything else questions
Just can't stay away
Just can't stay away


See User information
Not sure, but IIRC some ports/sources I have here position of link libraries are important (dependencies) as salass00 pointed.

LDFLAGS = -mcrt=newlib -lSDL_image -lpng -ljpeg -lz -lSDLmain -lSDL -lauto -lpthread -lm -lSDL_mixer -lsmpeg -lvorbisfile -lvorbis -logg -lstdc++ -lSDL



Go to top
Re: (Noob) compiling/linking and anything else questions
Just can't stay away
Just can't stay away


See User information
@Raziel

It's because the linker works from left to right and links in only those parts of static libraries that are needed to satisfy undefined references at that time. Both libSDL_mixer and libsmpeg need to use some functions from libSDL, but because it was linked before these libs the linker didn't know to link those needed parts.

Also libsmpeg2 is for libSDL2 only as you already guessed.

Go to top
Re: (Noob) compiling/linking and anything else questions
Home away from home
Home away from home


See User information
@salass00

I see, have to adapt my *personal* logic to that then
Thank you

@jabirulo

Thank you

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
c++11 to_string supported?
Home away from home
Home away from home


See User information
I'm using a bleeding edge build of gcc (adtools build 8.1.0) 8.1.0 and was under the impression it supportes c++11.

Now i'm trying to port some SDL2 example and it keeps throwing me this error
g++ -Wall -Wextra -`sdl2-config --cflags --static-libs` -std=c++11   --o Utils.o Utils.cpp
Utils
.cppIn function 'std::__cxx11::string Utils::intToString(int)':
Utils.cpp:58:14error'to_string' is not a member of 'std'
  
return std::to_string(num);
              ^~~~~~~~~
Utils.cppIn function 'int Utils::stringToInt(std::__cxx11::string)':
Utils.cpp:64:14error'stoi' is not a member of 'std'
  
return std::stoi(text);
              ^~~~
gmake: *** [Utils.oError 1


This is what i added to the Utils.cpp file, because it was missing, though it didn't make a difference
#include "Utils.hpp"
#include <time.h> //__amigaos4__
#include <string> //__amigaos4__
#include <sstream>   // sstream
#include <algorithm> // find_if
#include <utility>   // C++11
#include <random>    // C++11


and the makefile part

CXXFLAGS    = -Wall -Wextra -`sdl2-config --cflags --static-libs` -std=c++11

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: (Noob) compiling/linking and anything else questions
Quite a regular
Quite a regular


See User information
This is just a shot in the dark, but have you tried -std=gnu++11 instead of -std=c++11? The missing thing above might be part of the GNU extensions, not available in strict ANSI C mode.

This is just like television, only you can see much further.
Go to top
Re: (Noob) compiling/linking and anything else questions
Home away from home
Home away from home


See User information
@BSzili

Yes, i should have mentioned it, this was one of the "fixes" i found on stackoverflow, but the error is still the same.

g++ -Wall -Wextra -`sdl2-config --cflags --static-libs` -std=gnu++11   --o Utils.o Utils.cpp
Utils
.cppIn function 'std::__cxx11::string Utils::intToString(int)':
Utils.cpp:58:14error'to_string' is not a member of 'std'
  
return std::to_string(num);
              ^~~~~~~~~
Utils.cppIn function 'int Utils::stringToInt(std::__cxx11::string)':
Utils.cpp:64:14error'stoi' is not a member of 'std'
  
return std::stoi(text);
              ^~~~
gmake: *** [Utils.oError 1

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: (Noob) compiling/linking and anything else questions
Home away from home
Home away from home


See User information
Can projects, that rely on CMake, be also built using a manually created makefile or does CMake alter something that prevents that?

EDIT: To answer my own qiuestion...yes, they can.


Edited by Raziel on 2018/9/13 15:19:22
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: (Noob) compiling/linking and anything else questions
Home away from home
Home away from home


See User information
@all

Another question, this time AHI related:

I'm trying to port something that outputs sound through AHI.
While it works, the output volume is so darn low that i can barely hear a thing (in the normal WB/AHI/Sound volume setting im using everything else is fine)

I don't know much about AHI, so if anyone could tell me how i can up the volume i'd be grateful

This is the piece of code where AHI is set up:
#define BUFFERSIZE (4 << 10)

static struct MsgPort *AHImp NULL;
static 
struct AHIRequest *AHIReq[2] = { NULLNULL };
static 
int active 0;
static 
int8_t *AHIBuf[2] = { NULLNULL };

#define open_audio_output open_ahi_output
static int write_ahi_output(int8_t *output_dataint output_size);
static 
void close_ahi_output(void);

static 
int open_ahi_output(void) {
    
AHImp CreateMsgPort();
    if (
AHImp) {
        
AHIReq[0] = (struct AHIRequest *) CreateIORequest(AHImpsizeof(struct AHIRequest));
        if (
AHIReq[0]) {
            
AHIReq[0]->ahir_Version 4;
            
AHIReq[1] = (struct AHIRequest *) AllocVec(sizeof(struct AHIRequest), MEMF_PUBLIC);
            if (
AHIReq[1]) {
                if (!
OpenDevice(AHINAMEAHI_DEFAULT_UNIT, (struct IORequest *)AHIReq[0], 0)) {
                    
/*AHIReq[0]->ahir_Std.io_Message.mn_Node.ln_Pri = 0;*/
                    
AHIReq[0]->ahir_Std.io_Command CMD_WRITE;
                    
AHIReq[0]->ahir_Std.io_Data NULL;
                    
AHIReq[0]->ahir_Std.io_Offset 0;
                    
AHIReq[0]->ahir_Frequency rate;
                    
AHIReq[0]->ahir_Type AHIST_S16S;/* 16 bit stereo */
                    
AHIReq[0]->ahir_Volume 0x10000;
                    
AHIReq[0]->ahir_Position 0x8000;
                    
CopyMem(AHIReq[0], AHIReq[1], sizeof(struct AHIRequest));

                    
AHIBuf[0] = (int8_t *) AllocVec(BUFFERSIZEMEMF_PUBLIC MEMF_CLEAR);
                    if (
AHIBuf[0]) {
                        
AHIBuf[1] = (int8_t *) AllocVec(BUFFERSIZEMEMF_PUBLIC MEMF_CLEAR);
                        if (
AHIBuf[1]) {
                            
send_output write_ahi_output;
                            
close_output close_ahi_output;
                            
pause_output pause_output_nop;
                            
resume_output resume_output_nop;
                            return (
0);
                        }
                    }
                }
            }
        }
    }

    
close_ahi_output();
    
fprintf(stderr"ERROR: Unable to open AHI output\r\n");
    return (-
1);
}

What i've learned so far is that
AHIReq[0]->ahir_Volume = 0x10000;
sets the volume to 100%...but that doesn't help.

I assume this piece of code sends the output to a channel i haven't found how to alter the WB volume level of yet, but that's just a wild guess.

I played with the frequency and Type setting, to no avail.

There is no AHI_SetVol() in the code which i could alter.

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: (Noob) compiling/linking and anything else questions
Home away from home
Home away from home


See User information
Nevermind the AHI question, seems to have been a setting mixup on my platform

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project