Salve ragazzi,
so che è l'ennesima discussione aperta sul linker error, ma non riesco a risolvere il mio problema. Controllando tutti i thread nel forum, ho notato che questo :
http://forum.html.it/forum/showthrea...t=Linker+error
è quello che si avvicina di più alla mia situazione. Tuttavia vi allego codice ed errore:
e gli errori che compaiono sonocodice:#include <conio.h> #include <stdio.h> #include <windows.h> #include <mmsystem.h> int main(int argc, char** argv) { int ckey; int notestate = 0; int velocity = 100; int midiport; int flag; HMIDIOUT device; union { unsigned long word; unsigned char data[4]; } message; message.data[0] = 0x90; message.data[1] = 60; message.data[2] = 100; message.data[3] = 0; if (argc < 2) { midiport = 0; } else { midiport = atoi(argv[1]); } printf("MIDI output port set to %d.\n", midiport); system("pause"); flag = midiOutOpen(&device, midiport, 0, 0, CALLBACK_NULL); if (flag != MMSYSERR_NOERROR) { printf("Error opening MIDI Output.\n"); return 1; } printf("Press \"q\" to quit.\n"); while (1) { if (kbhit()) { ckey = getch(); if (notestate == 0) { message.data[2] = velocity; notestate = 1; printf("Note turned ON.\n"); } else { // Note is currently on, turn off note. message.data[2] = 0; notestate = 0; printf("Note turned OFF.\n"); } flag = midiOutShortMsg(device, message.word); if (flag != MMSYSERR_NOERROR) { printf("Warning: MIDI Output is not open.\n"); } if (ckey == 'q') break; } } midiOutReset(device); midiOutClose(device); return 0; }
Le cose che ho fatto, in base ai suggerimenti letti, sono le seguenti:codice:[Linker error] undefined reference to `midiOutOpen@20' [Linker error] undefined reference to `midiOutShortMsg@8' [Linker error] undefined reference to `midiOutReset@4' [Linker error] undefined reference to `midiOutClose@4' ld returned 1 exit status
- Ho creato un Progetto Windows Application
- Ho aggiunto ad esso il mio file .c e libwinmm.a
- Sono andato su Progetto->Opzioni del progetto->Files, ho selezionato libwinmm.a e ho spuntato Includi nella compilazione e Inlcudi nel link, ritrovandomi però un ultimo errore che mi ha convinto ad aprire questo thread:
Come fare? ._.codice:C:\Documents and Settings\Luca\Desktop\prog\Makefile.win [Build Error] [../../../../Dev-Cpp/lib/libwinmm.o] Error 255
Uso il BloodShed Dev-C++ su Windows.
Grazie 1000 a tutti![]()

Rispondi quotando