Hello, I've noticed something strange with compiling a project of mine. I don't know if this has anything to do with the compiler or with code blocks. Basically, I've noticed that I'm getting different compile results depending on where my file is located. Originally, I had my project buried somewhere in Documents. It gave errors there. But for various tests I was doing, I decided to make a copy. I just saved it on the Desktop. Once I tried compiling there, it compiled fine. All the errors say
error: invalid conversion from `void*' to `int*'
for every time I had a line like
int *setA = malloc(1000);
The files are EXACTLY the same in both places. In fact, continuing to test, I started doing a save as in each folder on the way to its original location of
C:\Users\****\Documents\CS 240\project 3\project 3\project3.c
It started giving those errors when I got to CS 240. So basically I'm wondering if this is a compiler error or a code blocks error, and if anyone knows how to fix it. Or even if I should be getting those errors or if it should actually be ignoring them.
I'm running code blocks 8.02, just the normal download, not nightly. 64-bit Vista. I got this with the standard C compiler, though I also tried downloading MinGW 5.1.6 and got the same behavior.
EDIT: realized I posted the results backwards. I was getting errors when it was in Documents, and not getting them on the Desktop. I updated the post
I've made sure that I changed the compiler to point to the new directory.
So here is what the build log says when I compile. The one that gives errors is in fact running g++.
mingw32-g++.exe -c "C:\Users\Mike\Documents\CS 240\project3\project3\project3.c" -o "C:\Users\Mike\Documents\CS 240\project3\project3\project3.o"
C:\Users\Mike\Documents\CS 240\project3\project3\project3.c: In function `int main()':
Errors....
and for the copy not giving errors. Side question - should this be running g++ also? I notice it does gcc, then g++ on the .o. It seems like this is just to make an .exe. Is that the case?
mingw32-gcc.exe -c C:\Users\Mike\Desktop\project3.c -o C:\Users\Mike\Desktop\project3.o
mingw32-g++.exe -o C:\Users\Mike\Desktop\project3.exe C:\Users\Mike\Desktop\project3.o
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
I looked in the properties for each file, and under the advanced tab, there is nothing. The fields are grayed out and the drop down box under 'Custom Build' is empty
EDIT:
ok, what I said about the properties was when the files were just by themselves. When I opened the project3.c file with the project I set up for it, I had a different screen. The compiler variable is CC only. Looking at the build output, its running gcc. So I suppose I should keep things in project files. Is there a reason it would be running the g++ when the file is just by itself? I can only assume that having spaces in the path is invalid for gcc, so it choose g++ instead.