Quake3World.com Forums
     Programming Discussion
        Compiling with lccwin32 - problems


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Compiling with lccwin32 - problems

Insane Quaker
Insane Quaker
Joined: 16 Sep 2010
Posts: 391
PostPosted: 05-14-2011 12:42 AM           Profile Send private message  E-mail  Edit post Reply with quote


So I`m trying to get into coding (while simultaneously learning Japanese... what a ride), so I`m following this tutorial: http://www.quake2.com/dll/tutorials/c/c1.html (It`s for Q2, but can usually be applied to Q3 as well)

It says to use lccwin32. I realize it`s majorly outdated but I`m more comfortable with following instructions exactly as they are told as I don`t want to mess things up and all. So I wrote the code down mentioned in the link, but when I go to compile it (make file) this is what I get:

f:\program files\lccwin32\lcc\bin\make.exe: Don't know how to make f:\program files\dll compiler\lcc\bin\hello.c

Any idea of what I`m doing wrong? :paranoid:

Thanks in advance. Hopefully if I learn enough in time I can help out Eraser a bit with his mod. (though I may only be able to do as much as add new items, etc. and not change major gameplay mechanics)



_________________
EmeraldProductions
http://emeraldproductions.weebly.com/index.html


Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 05-14-2011 02:43 AM           Profile   Send private message  E-mail  Edit post Reply with quote


My instinct is saying that perhaps you have an invalid makefile.




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 05-14-2011 04:44 AM           Profile Send private message  E-mail  Edit post Reply with quote


That tutorial isn't applicable to Q3A, you need to download the SDK.




Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 05-14-2011 11:11 AM           Profile   Send private message  E-mail  Edit post Reply with quote


from what I read he's just trying to get

Code:
int main(int argc, char **argv){
    printf("hello, world!");
    return 0;
}


to compile with lccwin32 for right now.




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 05-14-2011 01:38 PM           Profile Send private message  E-mail  Edit post Reply with quote


You're right. I might have spoken out of turn if the goal is to learn C in general, not as it pertains to Q3A.

@EmeraldTiger: may I recommend Visual Studio Express? It's a great IDE and you won't have to fudge with Makefiles.




Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 05-14-2011 03:03 PM           Profile   Send private message  E-mail  Edit post Reply with quote


I second misantropia's suggestion.

makefiles are no fun :(




Top
                 

Insane Quaker
Insane Quaker
Joined: 16 Sep 2010
Posts: 391
PostPosted: 05-14-2011 08:52 PM           Profile Send private message  E-mail  Edit post Reply with quote


So now I`m using Visual Studio 2008, following this tutorial on C++: http://www.learncpp.com/

I`m trying to write a function which takes an integer parameter and returns double it`s value. I followed what the tutorial had to say and looked back and carefully examined where to put the code, this is what I did:

Code:
#include <stdafx.h>
#include <iostream>

int doubler(int x, int 2)
{
   return x * 2; // takes a specified value and returns double it`s value
}

int main()
{
   using namespace std
   cout << doubler(6, 2) << endl;
   return 0;
}


I coded it right (no syntax errors or whatever) but my compiler spits out this one and only error message:

Code:
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory


The C++ guide told me I could use VS2008, yet I`m getting an error message for missing paths even though I did exactly what they said. Why is it at the top of the Google listings for "learn c++" if it`s relying on an outdated version of the program? That confuses me greatly, and defies all common sense and logic.

Thank you very much in advance.



_________________
EmeraldProductions
http://emeraldproductions.weebly.com/index.html


Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 05-14-2011 09:07 PM           Profile   Send private message  E-mail  Edit post Reply with quote


stdafx.h is a precompiled header.

For this current program you can remove that include line and the compiler will complain about a couple more things:

"int double(int x, int 2)" is incorrect. You can't use a number as a variable name in c++. You can rewrite this as

Code:
int doubler(int x, int num){
    return x * num;
}


and you also forgot a semi-colon after "using namespace std"

Something to note - the 'using namespace std;' line (dont forget the semicolon) usually goes right under the include statements and not in the main function.

On another note, you might want to get in the habit now of just prefixing std functions with std:: instead of falling back on "using namespace". In larger projects it makes things, in my opinion, more clear on what's coming from where.




Top
                 

Insane Quaker
Insane Quaker
Joined: 16 Sep 2010
Posts: 391
PostPosted: 05-14-2011 09:18 PM           Profile Send private message  E-mail  Edit post Reply with quote


I got it working now, thank you. :up:

I am upset however that my compiler is so stupid. Does anyone know of a compiler that will list all the errors from the start? I wonder why it will mention that a file does not exist yet it won`t even complain about the syntax errors until I fix the other issue.



_________________
EmeraldProductions
http://emeraldproductions.weebly.com/index.html


Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 05-14-2011 11:02 PM           Profile   Send private message  E-mail  Edit post Reply with quote


Well, the compiler won't complain about syntax issues because there's no point in doing so if it already encountered a fatal error (missing file). The compiler just assumes the program won't compile without the file and bails out.




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 05-15-2011 04:29 AM           Profile Send private message  E-mail  Edit post Reply with quote


EmeraldTiger wrote:
I am upset however that my compiler is so stupid. Does anyone know of a compiler that will list all the errors from the start? I wonder why it will mention that a file does not exist yet it won`t even complain about the syntax errors until I fix the other issue.

If you use the VS IDE, it'll highlight syntax and other errors as you type.




Top
                 

Señor Shambler
Señor Shambler
Joined: 07 Mar 2006
Posts: 849
PostPosted: 05-15-2011 02:29 PM           Profile Send private message  E-mail  Edit post Reply with quote


You might already know this, but Q3 is straight ANSI C instead of C++, just in case you're learning this for the primary purpose of modding Q3. Either way, keep at it! :up:




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.