Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Why Won't This Compile D:
Goto page 1, 2  Next
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
EBODude
Expert Cheater
Reputation: 0

Joined: 18 Oct 2007
Posts: 136

PostPosted: Thu Dec 18, 2008 10:19 pm    Post subject: Why Won't This Compile D: Reply with quote

Before I get flamed for asking a noob question or not knowing what the hell I'm doing, I want to say this is my first day trying to code C++ and I'm following a tutorial.

I'm using Visual C++ 2008 Express Edition, and this is what I'm trying to compile, or build:

Code:
// This is a comment
// This program will accept numbers and display their sum

#include <iostream.h>

void main()
{
  // define variables
  float num1;
  float num2;
  float total;

  // Enter data for the variables
  cout << "Enter a value for the first variable:  ";
  cin >> num1;
  cout << "Enter a value for the second variable:  ";
  cin >> num2;

  // Add the two numbers together
  total = num1 + num2;

  // Display the result
  cout << "The sum of the numbers = " << total
 
}


My compile error is:

Code:
1>------ Build started: Project: Cpp1, Configuration: Debug Win32 ------
1>Embedding manifest...
1>mt.exe : general error c10100b1: Failed to load file "..\Debug\Cpp1.exe". The system cannot find the path specified.
1>Build log was saved at "file://c:\Documents and Settings\Krzysiu\My Documents\Visual Studio 2008\Projects\Cpp1\Cpp1\Debug\BuildLog.htm"
1>Cpp1 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



Can anyone help me out? Google doesn't really help.
Back to top
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Thu Dec 18, 2008 10:36 pm    Post subject: Reply with quote

Maybe file is running, or is protected.
also add return 0; at end of main.

_________________
Back to top
View user's profile Send private message Send e-mail
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Dec 18, 2008 10:39 pm    Post subject: Reply with quote

AlbanainRetard wrote:
Maybe file is running, or is protected.
also add return 0; at end of main.


why would he add return 0; when main is type void.

_________________
Back to top
View user's profile Send private message
EBODude
Expert Cheater
Reputation: 0

Joined: 18 Oct 2007
Posts: 136

PostPosted: Thu Dec 18, 2008 11:05 pm    Post subject: Reply with quote

AlbanainRetard wrote:
Maybe file is running, or is protected.
also add return 0; at end of main.

What do you mean? Visual C++ 2008 Express Edition is running, but it won't compile. What do you mean the file is protected?
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Thu Dec 18, 2008 11:08 pm    Post subject: Reply with quote

I don't think you've added the source file to your project correctly. If you were to create an empty project and build it, you will receive the same error. This would happen if you've created your source file using File -> New without adding it to the project.

On your left you should see the project name with 3 folders below (header, resource & source files), right click the source files folder -> add -> new item / or add your existing cpp file to the project.


Last edited by sloppy on Thu Dec 18, 2008 11:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
slippppppppp
Grandmaster Cheater
Reputation: 0

Joined: 08 Aug 2006
Posts: 929

PostPosted: Thu Dec 18, 2008 11:08 pm    Post subject: Reply with quote

you dont need a return 0. Void means that the coder doesnt care about the return value. Anywho, EBO, close your Compiler, rerun, rebuild
Back to top
View user's profile Send private message AIM Address MSN Messenger
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Fri Dec 19, 2008 1:11 am    Post subject: Reply with quote

His program isn't going to link because there is no int main. Change "void main" to "int main". Also, add a return 0 - it won't solve the problem (with no return, it will compile and leave eax as is, which will give it some random return value) but it is a good idea.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Fri Dec 19, 2008 4:20 am    Post subject: Reply with quote

// Display the result
cout << "The sum of the numbers = " << total;
return 0;

}
Back to top
View user's profile Send private message
EBODude
Expert Cheater
Reputation: 0

Joined: 18 Oct 2007
Posts: 136

PostPosted: Fri Dec 19, 2008 10:01 am    Post subject: Reply with quote

I make a project called Demo1 as a Empty Project.

Then I make a new file, put the code in, then save it as Demo1.

I press Build, then Build Demo1.

And I get that error over and over. And it's not a coding error, I just don't think I'm creating the workspace or whatever you want to call it the right way.
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Fri Dec 19, 2008 10:07 am    Post subject: Reply with quote

blankrider wrote:
AlbanainRetard wrote:
Maybe file is running, or is protected.
also add return 0; at end of main.


why would he add return 0; when main is type void.


and slippppppppp

using "void main" which should be "int main" is the main function in c++
void int isent allowed in some c++ compilers and some big company's so it is incorrect

the main function should always look like this
int main() {return X;}


ontopic
delete the "debug" folder and try compile it again
if you cant delete it restart your computer and try again (press rebuild all)

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
EBODude
Expert Cheater
Reputation: 0

Joined: 18 Oct 2007
Posts: 136

PostPosted: Fri Dec 19, 2008 10:23 am    Post subject: Reply with quote

ups2000ups wrote:
blankrider wrote:
AlbanainRetard wrote:
Maybe file is running, or is protected.
also add return 0; at end of main.


why would he add return 0; when main is type void.

ontopic
delete the "debug" folder and try compile it again
if you cant delete it restart your computer and try again (press rebuild all)

Doesn't do anything. I get the same error.
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Fri Dec 19, 2008 10:30 am    Post subject: Reply with quote

EBODude wrote:
ups2000ups wrote:
blankrider wrote:
AlbanainRetard wrote:
Maybe file is running, or is protected.
also add return 0; at end of main.


why would he add return 0; when main is type void.

ontopic
delete the "debug" folder and try compile it again
if you cant delete it restart your computer and try again (press rebuild all)

Doesn't do anything. I get the same error.


ok weird i mean it should be able to find the file it just created
it look like it is protected or already running or something idk really

well you could try this too
go to C:\windows\prefetch and delete everything in it
then try to compile your file again

idk why but thats a common problem for me and some other i know (happening often when you try to inject some dll into something and application crashes)

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
EBODude
Expert Cheater
Reputation: 0

Joined: 18 Oct 2007
Posts: 136

PostPosted: Fri Dec 19, 2008 10:35 am    Post subject: Reply with quote

So there's no fix?

Would another IDE fix it? The tutorial I'm following is using Visual C++ 6.

What's the 'best' for newbies out there?

EDIT: Forgot to say, after I deleted everything in the prefetch folder, it still didn't work.
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Fri Dec 19, 2008 10:42 am    Post subject: Reply with quote

EBODude wrote:
So there's no fix?

Would another IDE fix it? The tutorial I'm following is using Visual C++ 6.

What's the 'best' for newbies out there?

EDIT: Forgot to say, after I deleted everything in the prefetch folder, it still didn't work.


well idk if there is a fix for it i use VC++ 6 because i think VC++ 8 take more speces when you make the project and alot of crap files when it creates a project

and vc++ 6 looks better Razz

sorry for not being able to help you should search for the problem on google

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Fri Dec 19, 2008 12:18 pm    Post subject: Reply with quote

EBODude wrote:
I make a project called Demo1 as a Empty Project.

Then I make a new file, put the code in, then save it as Demo1.

I press Build, then Build Demo1.

And I get that error over and over. And it's not a coding error, I just don't think I'm creating the workspace or whatever you want to call it the right way.

After you've made an empty project, how are you creating the new source file? Can you upload a screenshot of the IDE with your project open or upload the project itself?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites