|
Compiling user environment variable problems |
yozshura
Member #7,420
June 2006
|
Since I haven't been with my computer in a long time(being repaired), I decided to try to get the MinGW compiler to work on my user drive at school, but I've been having some problems. First of all I can only change the user variables of the computer I am using, and I have these in there: Also I have all the needed allegro files in the MinGW include and lib folders. The problem occurs when I use command prompt to compile a program. I set up a test file and compiled with: U:\>gcc test.c -Wl,--subsystem,windows -O2 -Wall -o test.exe -lalleg I wasn't sure about what compiler options I needed so I just used the example in the docs. These are the errors I got: test.cpp:1:21: allegro.h: No such file or directory test.cpp: In function `int main()': test.cpp:5: error: `allegro_init' undeclared (first use this function) test.cpp:5: error: (Each undeclared identifier is reported only once for each fu nction it appears in.) test.cpp:6: error: `allegro_message' undeclared (first use this function) test.cpp: At global scope: test.cpp:9: error: expected constructor, destructor, or type conversion before ';' token test.cpp:9:15: warning: no newline at end of file Here is test.cpp #include <allegro.h> int main() { allegro_init(); allegro_message("all is good"); return 0; } END_OF_MAIN(); edit:fixed part that i screwed up, really sorry about that. "Stupidity isn't punishable by death. If it was, there would be a hell of a population drop." -Anita Blake: PSN: leogorerd |
CGamesPlay
Member #2,559
July 2002
|
U:\gcc isn't the same compiler as U:\MinGW\bin\gcc, and the second is the one that will look for U:\MinGW\include\allegro.h. I have no idea where U:\gcc would look for includes. You can either not use U:\gcc (just "gcc" will work fine since MinGW is in your path), or you can pass -IU:\MinGW\include to the compiler. -- Ryan Patterson - <http://cgamesplay.com/> |
yozshura
Member #7,420
June 2006
|
Ah, thank you. I thought that since mingw was in the path that using 'gcc' in any directory would work. Thanks CGamesPlay. "Stupidity isn't punishable by death. If it was, there would be a hell of a population drop." -Anita Blake: PSN: leogorerd |
LennyLen
Member #5,313
December 2004
|
Quote: I thought that since mingw was in the path that using 'gcc' in any directory would work. It does, which is why CGamesPlay said "just "gcc" will work fine since MinGW is in your path". Did you type "U:\gcc test.c -Wl,--subsystem,windows -O2 -Wall -o test.exe -lalleg" after the command prompt, or is the "U:\" in there the command prompt? Because to even be recognized as a command, "U:\gcc" requires that gcc.exe be in the U: directory. And even then, gcc still won't work, as it requires that other executables be there as well. However, if "U:\" was the command prompt, and the command you entered was "gcc test.c -Wl,--subsystem,windows -O2 -Wall -o test.exe -lalleg", then it should have worked.
|
yozshura
Member #7,420
June 2006
|
The "U:\" was already in the command prompt, and it didn't work. So I am a little confused now, it should have originally worked? Then what is happening? "Stupidity isn't punishable by death. If it was, there would be a hell of a population drop." -Anita Blake: PSN: leogorerd |
CGamesPlay
Member #2,559
July 2002
|
LennyLen: He was using the instance of gcc.exe located at U:\gcc.exe. That one wasn't configured to look in MinGW\include, et al for directories. It won't work because gcc.exe looks in ..\include. (It expects gcc.exe to be in U:\MinGW\bin, so ..\include is U:\MinGW\include.) Quote: However, if "U:\" was the command prompt, and the command you entered was "gcc test.c -Wl,--subsystem,windows -O2 -Wall -o test.exe -lalleg", then it should have worked. No, U:\wasn't his CWD, it was part of the command: U:\> gcc test.c -Wl,--subsystem,windows -O2 -Wall -o test.exe -lalleg That is not what he had, he had: U:\projects> U:\gcc test.c -Wl,--subsystem,windows -O2 -Wall -o test.exe -lalleg
-- Ryan Patterson - <http://cgamesplay.com/> |
yozshura
Member #7,420
June 2006
|
Oh, I see what is going on, damn, BIG typo on my part sorry, "Stupidity isn't punishable by death. If it was, there would be a hell of a population drop." -Anita Blake: PSN: leogorerd |
CGamesPlay
Member #2,559
July 2002
|
Okay, so your problem is still outstanding? Do the computers have another version of gcc installed on them? Running gcc --print-search-dirs should give you a tip. If that's the case, you need to modify your PATH so that U:\MinGW\bin comes before the other one. echo %PATH%, if you find out that you have multiple gccs installed. -- Ryan Patterson - <http://cgamesplay.com/> |
|