Thread: Compiling

  1. #1
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034

    Question Compiling

    Alright this is embarrassing..

    Basicly I've been writing a project with Dev-Cpp and I've had problems where its saying either variables are out of the scope, or classes are being redefined, or variables dont even exist.

    I searched and I need to add commands to the makefile to get access to some library to stop the errors or whatever.. so I figured why not stop using Dev-Cpp's easy mode compiling (which btw I think was screwing me up too with the errors) since I couldnt figure where to add that command to be in the compiling process.

    I searched and read like.. 5 or more little tutorials on makefiles, which gave me good info on them and I made various makefiles but none work because I dont know how to compile the makefile. The tutorials neglected to mention anything more than saying "type make".

    I've tried running my C:\Dev-Cpp\bin\make.exe file in command prompt, says theres no command or makefile found.. so I try C:\Dev-Cpp\bin\make.exe make -f makefile, nada. I tried Run As.. on the makefile to run make.exe which did do something (said it couldnt find a file or w/e but it did something) but the dos window would disappear instantly.

    I have my project .cpp, .cpp, .h, .h and makefile, with no clue how to put it together. (which is odd because I remember being able to do it once)

    Any help? please and thank you..

    -------------------------
    I'm on a windows OS, and am doing this in C++

  2. #2
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    to ease up a bit place the Dev-c++\bin directory on the path environement variable.
    I think that make.exe is using that bin directory as working directory instead of the dir where your makefile is

  3. #3
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Well I dont have a path enviroment variable so I said screw it and just moved my project files to the /bin directory.. and its doing something but the prompt box wont stay open for me to read my errors =/

  4. #4
    Registered User
    Join Date
    Dec 2003
    Posts
    50
    Quote Originally Posted by Dae
    I searched and read like.. 5 or more little tutorials on makefiles, which gave me good info on them and I made various makefiles but none work because I dont know how to compile the makefile. The tutorials neglected to mention anything more than saying "type make".
    -------------------------
    I'm on a windows OS, and am doing this in C++

    The tutorials should mention that you need to run Command Prompt.
    Then at the "blinking" cursor, type the command make. This is will work provided you have an environment variable that points to the compiler path and that your make file's name is makefile.

  5. #5
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by yeohhs
    The tutorials should mention that you need to run Command Prompt.
    Then at the "blinking" cursor, type the command make. This is will work provided you have an environment variable that points to the compiler path and that your make file's name is makefile.
    Yah they all say to type make.. typing make didnt do anything for me in command prompt so thats where I got lost.

    So and environment variable.. thats in the properties of My Computer isnt it.. I'll see what I can do.. never explained this anywhere, just assumed I'm reading a 'Compiling for Newbies' tutorial and automatically have an environment variable for make setup.


    It doesnt do anything for command prompt, typing: make, nothing, nor the examples before work. However if I type make in the Run its like a shortcut to the make.exe file, yay
    Last edited by Dae; 06-14-2005 at 08:03 PM. Reason: blah

  6. #6
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    So the enviroment variable is only a shortcut when I type "make" in Start->Run.. instead of anything to do with the command prompt? because thats what it looks like.

    When I open the make.exe file thats in the same directory as my makefile it IS doing something, but how do I get the prompt box to stay open?..

    I know that isnt how it should be working, putting my project in the same file as the make.exe, but thats the only way it seems to work for me.

    I guess I should have editted my last post.. agh
    Last edited by Dae; 06-14-2005 at 09:05 PM. Reason: edit

  7. #7
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    Quote Originally Posted by Dae
    Well I dont have a path enviroment variable so I said screw it and just moved my project files to the /bin directory.. and its doing something but the prompt box wont stay open for me to read my errors =/
    ............
    Quote Originally Posted by Dae
    So and environment variable.. thats in the properties of My Computer isnt it..
    Yes !! The operating system variables !!!!

    Second.. the all might helper FAQ question, asked by all DevCpp unexperienced...
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385

  8. #8
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by xErath
    ............


    Yes !! The operating system variables !!!!

    Second.. the all might helper FAQ question, asked by all DevCpp unexperienced...
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    Alright...

    Figured out your running a different prompt than me: cmd (or command) I was running command prompt.

    Well that makes it so I can run make.exe from cmd like you said.. but its still just a shortcut, it doesnt help me. That FAQ answer is what I was having problems with to start.. .. when I run make.exe from the folder.. it does stuff, when I run it from the cmd it just says I havent declared a make file or defined a rule (if I '-f url/makefile' then it just says I havent defined a rule).

    and the rest of the FAQ isnt helpful for what I'm doing.

    Edit: Hey,

    Think one of my problems or at least something that isnt helping is I'm using Dev-Cpp's bin files which are configured only by using them through Dev-Cpp..

    Nevermind edit.. I'm trying to install the g++ so I'm not using Dev-Cpp's unconfigured files. These people making gcc are on crack.. " cd gccbuilddir
    gccsrcdir/configure --prefix=destdir --other-opts..." "libstdc++ sources is to go to the source directory and then type: ./configure --help" - i cant find a source directory, or a gccsrcdir directory, or anything these install files are talking about.. ohh and I need a list of like 10 files just to install gcc, even though i only want g++ i get refered there (http://gcc.gnu.org/install/prerequisites.html) .. I just want to install the g++ library but i guess ill end up installing the gcc library, that might take me 5 hours though.. happy day happy day happy haapaaa.. ahhhhhhh (did find one of those files, and the other is suppose to be created, but the command didnt work and I'm still lost)

    ----------------------------------------------------------

    I found a 'install g++ for dummies' file at some site (http://www.cs.utah.edu/~alee/g++/g++.html) .. quick and easy and its working EXACTLY how you said it would. Problem: its using some g++ from 1991 (I believe), LOL... and the site that developed it is no longer in business (obviously) so dont ask what version of a compiler I have.. probably 1.1.3 or something when the current one is 4.0.0.

    Greaaaat, back to the install docs for the migraine gcc..

    Thanks though, its still a step forward if I can understand the current version install docs
    Last edited by Dae; 06-15-2005 at 03:40 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling Issues
    By pc_doctor in forum C Programming
    Replies: 3
    Last Post: 11-30-2007, 10:00 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 01:09 AM
  4. compiling and executing issue with lcc win32
    By GanglyLamb in forum C Programming
    Replies: 10
    Last Post: 12-22-2004, 02:24 PM
  5. Compiling syntax
    By Jez_Master in forum C++ Programming
    Replies: 3
    Last Post: 04-01-2002, 09:46 PM