Why my code doesnt compile if weeks ago worked perfectly?
up vote
-3
down vote
favorite
I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like
" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "
This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)
int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;
c compiler-errors
add a comment |
up vote
-3
down vote
favorite
I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like
" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "
This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)
int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;
c compiler-errors
2
You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code withPlaySound
as C, butProyecto.cpp
is looking for a C++ function?
– nemequ
Nov 11 at 5:31
If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like
" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "
This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)
int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;
c compiler-errors
I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like
" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "
This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)
int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;
c compiler-errors
c compiler-errors
edited Nov 11 at 5:38
chux
79.1k869145
79.1k869145
asked Nov 11 at 5:22
A. SuSa
12
12
2
You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code withPlaySound
as C, butProyecto.cpp
is looking for a C++ function?
– nemequ
Nov 11 at 5:31
If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43
add a comment |
2
You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code withPlaySound
as C, butProyecto.cpp
is looking for a C++ function?
– nemequ
Nov 11 at 5:31
If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43
2
2
You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with
PlaySound
as C, but Proyecto.cpp
is looking for a C++ function?– nemequ
Nov 11 at 5:31
You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with
PlaySound
as C, but Proyecto.cpp
is looking for a C++ function?– nemequ
Nov 11 at 5:31
If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43
If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound
is likely missing from your build/include step?
Are you sure you are using the exact build/link steps as you were previously?
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound
is likely missing from your build/include step?
Are you sure you are using the exact build/link steps as you were previously?
add a comment |
up vote
2
down vote
I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound
is likely missing from your build/include step?
Are you sure you are using the exact build/link steps as you were previously?
add a comment |
up vote
2
down vote
up vote
2
down vote
I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound
is likely missing from your build/include step?
Are you sure you are using the exact build/link steps as you were previously?
I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound
is likely missing from your build/include step?
Are you sure you are using the exact build/link steps as you were previously?
answered Nov 11 at 5:25
DMarczak
1119
1119
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246067%2fwhy-my-code-doesnt-compile-if-weeks-ago-worked-perfectly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with
PlaySound
as C, butProyecto.cpp
is looking for a C++ function?– nemequ
Nov 11 at 5:31
If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43