I just spent a long time trying to figure out a problem, and when i finally figured it out, i had to change the file from a .c to a .cpp, it gave me this new error message
mingw32-g++.exe: error: obj\Debug\Untitled1.o: No such file or directory
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
usingnamespace std;
int main()
{
int mynumber;
mynumber = 10;
cout << mynumber << endl;
return 0;
}
Your project setting are messed up because you changed the file. My advice if that is all that your program is just start over from scratch and make a new project.
I did that, and now i have this error message,
`main'
obj\Debug\main.o:C:/Users/David/Documents/C++/Variables/main.cpp:6: first defined here
collect2.exe: error: ld returned 1 exit status
Im confoused!
you a brand new coder? even though this took me forever to suss out and they never write enough about it,
the compiler knows how to crunch keywords into machine code, and it needs to know how to do that by knowing where all the source code is to do that, where it looks is the liker options, i didnt have to worry about this right away, unfortunatley you do, dont be put off though, this bit is hard and you dont normaly have to deal with it straight away
my problem right now is that im trying to add libraries and my linker doesnt know where they are, so it doesnt know what the keywords i popped in actually mean! so i get the same error you are!
this is hard to explain, we need one of the better coders to help you because this is my weakness
bin
obj
main,cpp
untitled1.cpp
variables.cpp
variables.depend
variables.layout
Those are all of the files
And yes, this is third day, spending the second day trying to figure this out. And i also just installed Code: :Blocks.
you get days like that, I remember there are tutorials on using for the first time, making sure you use the right compiler settings , are you using version 12.11??
Just delete all them files so the Variables folder is nice and clean then try creating a new project in that folder.
If that doesn't work I would do a full reinstall of your compiler/IDE. It is most likely not a linker problem since the compiler should have set up all the linker setting for you automatically (Though it can mess up sometimes which is why a reinstall might help) and you haven't downloaded any libraries on your own i don't think.