C :: Same Error Returned For All Code
Mar 11, 2014
I've had with visual studio but nothing seems to be working. No matter what I do even with simple programs, like Hello World, I'm always getting an error about a .pch header file.fatal error C1083: Cannot open precompiled header file: 'DebugConsoleApplication1.pch': No such file or directory
This is only for one of the programs I've made but I'm pretty new to programming and I've not even used the header files for anything so I have no clue how to resolve this problem.
View 2 Replies
ADVERTISEMENT
Nov 18, 2013
I am working on my final project for my class and after finally getting it to compile with no errors to finding examples/tutorials and following skeleton code I cam encountering a problem.
The program runs, asks all the correct questions but when it displays the base pay and total pay for all 3 employees it comes back as ( -1.0743 blah blah )
When they work over 40 hours it works correctly but when they work under 40 hours it displays those weird numbers in those sections.
// Kevin Johnson -- Overtime Pay -- Final Assignment
// Created 11/14/2013 // Edited 11/17/2013
#include "stdafx.h"
[Code]....
View 9 Replies
View Related
Jul 13, 2014
I'm new to C++ and keep getting an error. I get a permission denied and id returned 1 exit status, the code is fine and as far as i understand this would be because my OS doesn't allow modification of currently running files which would make sense as when i look in task manager it shows my program running even though it has finished. Ending process/process tree does nothing as does using any third party process terminator.
There is no loop in the program or anything even a simple hello world program yields the same result. Only way i can re-run my program is restarting my computer or saving the project under another name and re-compiling...
View 4 Replies
View Related
Mar 19, 2014
I am trying to compile a program with the graphics.h library included but I always get this error:Id returned 1 exit status.
View 1 Replies
View Related
Mar 17, 2013
i am running this code but i am geting few errors .as shown in the image
Code:
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <string>
using namespace System;
[Code] .....
View 7 Replies
View Related
Jan 27, 2015
I was working on template and found the linker error while compiling the code.
Below is the code:
Code: //Template1.h: Header file where template define
#ifndef __Template1_H__
#define __Template1__
template <typename T,typename T1> class A
{
T a;
T1 b;
public:
A(T ,T1 ) ;
[code].....
View 8 Replies
View Related
Jan 31, 2014
I am trying to use struct to store variables from a text file and use them in the main program. I have first tried running the program without using struct and declaring the variables within the main program and it runs fine. But after using struct, it gives no compilation error and a segmentation fault as output. Also, if the size of file/variable size is unknown can I declare variables as char string[]??
The code is as below:
Code:
#include<stdio.h>
struct test {
char string1[10000];
[Code].....
View 4 Replies
View Related
Dec 3, 2013
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int encrypt_data(FILE *);
[Code] ....
I am trying encrypt the file "encrypt" when I enter it I get "Error in reading file"
I think its a problem with the fgets() and scanf()...I tried both fgets out and then scanf but I get the same error.
I look in the directory and see that when I enter a file to be encrypted a blank file with a "?" at the end is created in the directory. so I try to encrypt "encrypt" it shows error then creates "encrypt?"
I then tested it by entering a random file name that does not exist
EXAMPLE
Please enter file to be encrypted: fakefilename
Error in reading file.
I look in the directory the non existent file now is listed "fakefilename"
View 1 Replies
View Related
May 12, 2013
I've written a c++ program that contains the following classes: class Shape, Circle, Ellipse, Rectangle, Triangle. All the classes are a subclass of class Shape. They syntax of their definition is fine, I see no visible errors. This is the code:
#include "graphics.h"
//#include <iostream>
using namespace std;
const float Pi = 3.141;
float distance (int x1, int y1, int x2, int y2) {
[Code] ....
Now when I declare a variable of each subclass in the main, I get an error on two of the classes.
int main () {
Circle a;
Rectangle b;
Ellipse d;
Triangle c;
int x1, y1;
float length;
[Code] .....
...And there's a bunch of similar if conditions. My compiler gives an error under b and d, i.e. the Rectangle object and the Ellipse object. The error is, "Expected a ';'" . I have quadruple checked every inch of my code and as far as I can tell, there are no missing semicolons. Where this ";" belongs ....
View 2 Replies
View Related
Dec 8, 2013
Basically, I'm moving a VC project from my Windows 7 build machine to a new build machine that's running Windows 8.1. One of the pre-build steps (for a particular project) runs a script which needs to call the M4 macro processor (which is installed on my C: drive). I've been pretty careful to set everything up the same on both machines (including my PATH) but when I try to build the project on my Windows 8 box, MSVC's IDE shows me this error output when running the script:-
m4 failed with exit code 255
View 5 Replies
View Related
Mar 24, 2013
main()
{
printf("%lf",5/2);
}
this code is giving runtime error ....why ?
View 3 Replies
View Related
Jan 24, 2014
Ok, this thing works as far as the getting the image and drawing the rectangle but for the life of me I cannot figure out why it is causing an in the program.cs.
public partial class Crop : Form {
public Crop(Image BaseImage) {
InitializeComponent();
if ((Bitmap)BaseImage != null) { pbOriginal.Image = BaseImage; }
[Code] ....
BaseImage is pulled in from the main form's picture box.
View 14 Replies
View Related
Sep 29, 2013
Thing I want is find the largest sum down a triangle,(moving to adjacent numbers on the row below )there are many methods to go down.
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
I wrote a program with a recursive() called finder. But it dose not work properly,at run time it becomes to a infinite status. How to detect the error at runtime. Here is the code.
#include<stdio.h>
void finder(int x,int y);
int tot;
[Code] ....
I think the error is the changing value of x after a round of for loop.
View 2 Replies
View Related
Mar 27, 2015
In Visual Studios I keep getting this error. cpp(36): error C4700: uninitialized local variable 'Eligible' used
Code:
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
void Getinput(int& Loantype, double& Income, double& Totaldebt, double& Loanamount);
[Code] ....
View 4 Replies
View Related
Apr 22, 2012
Why is it not okay to return void? Most compilers will probably let you (gcc does) but it gives you a warning that you aren't supposed to. Most languages allow you to return void.
Something like
Code:
void log(const std::string & txt){ std::cout << txt << std::endl; }
//C++ way to do it
void bar(int i){
[Code].....
View 10 Replies
View Related
Aug 28, 2014
I have this int type function that returns a number. It returns the value 2 for now but later it will return more variety of values. How do I use the value it returned? I'm not sure of the proper syntax.
View 5 Replies
View Related
Oct 18, 2013
This is my code:
Code:
#include <math.h>
#include <stdio.h>
int main(void) {
float a,b,c,root_1,root_2;
printf("Please enter value a from the quadratic equation
[Code] ......
And I keep getting this error:
Code:
/tmp/ccgtUIun.o: In function `main':
assign345.c:(.text+0xc7): undefined reference to `sqrt'
assign345.c:(.text+0xef): undefined reference to `sqrt'
collect2: ld returned 1 exit status
View 5 Replies
View Related
Jul 14, 2014
I have some struct which contains: void *elems (basically a pointer to an array of contiguous memory).
I want to use bsearch to return a pointer, and then somehow figure out where in the array that value is. Having a pointer in this case isn't enough, I need to know what the index is. I've tried a number of things:
int index;
void *value = bsearch(key, start_ptr, cv->count, cv->elemsz, cmp);
index = &value - &start_ptr;
return index; [
Replacing the second line with:
// in the first instance
index = (char*) value - (char*) start_ptr;
// in other instances...
index = ((char*) value - start_ptr))/cv->elemsz)
But nothing works.
View 6 Replies
View Related
Sep 15, 2014
I call a function that returns a string, and I can print it out fine, but I want to test the result of the function to see if it returns 0. But I can't just call the function again (GetNextToken(b)) because it will generate a different token. I can't allocate space for the string because I'm not sure what the size of the returned string is going to be.
Basically I want to see if the GetNextToken(b) returns 0, and if it doesn't then print the string. And running GetNextToken(b) again will give a different result.
Code:
int main(int argc, char **argv) {
SomeStruct* b = CreateStruct(argv[1],argv[2]);
printf("HERE %s", GetNextToken(b));
View 3 Replies
View Related
Dec 6, 2013
So, I'm in the midst of implementing my own malloc() and free() functions, but I'm having a hard time with the syntax of getting the address that malloc returns. Whenever I check the address, it's 0 Here's the code:
Code:
char *word = malloc(10);
int address = *word;
printf("%d",address);
The reason I want the address is so that I could store it in a data structure for further usage when I'm dealing with different cases for the free() function. Or is there another way to do this?
View 5 Replies
View Related
May 4, 2014
What does the C++ standard say about returned temporal objetcts's lifetime ?For example, in this code:
#include <iostream>// Object cout, manipulator endl
using std::cout;
using std::endl;
class C {
private:
[code]....
Here, the temporal object C returned by function f() still lives when function h() is called and is destroyed inmediately after function h() returns to his caller (the function main()). So, it seems that a returned temporal object lives while it is used and it is destroyed when not used (in the next sentence of the sentence that call the function that returns the temporal object). Does the C++ standard specify that this must be the behaviour of C++ compilers?
View 1 Replies
View Related
May 16, 2014
I'm trying to read a data returned from a web service. How i could extract the juice of this document in c#?
Here's the code
<?php
require_once("nuSOAP/lib/nusoap.php");
//require_once("Classes/Connection.class.php");
//require_once("Classes/Customer.class.php");
require_once("includes/config.php");
[Code] ....
How will i extract the result from the Array Customer?
View 2 Replies
View Related
Jan 29, 2014
I want know if the query returned zero rows or not.
Don't want to use count(*)
sql = "select * from TABLE where employeefirstname = @First order by EmploymentStatusDescription";
using (SqlCommand cmd = new SqlCommand(sql, conn)) {
cmd.Parameters.AddWithValue("@First", First);
reader = cmd.ExecuteReader();
} while (reader.Read())
View 7 Replies
View Related
Jan 25, 2014
I have a question about the exact time units returned by the GetProcessTimes function from the Windows API. Is it in seconds or some other unit?
View 3 Replies
View Related
Feb 12, 2014
I am just trying to make a simple two player game. First player enters the movie and second player guesses it by using some basics of C++.
movie[] = entered by player 1.
movie_temp[]= a temp array with '_' in it. It updates after every guess by player 2.
MY PROBLEM: Please refer the main function where I called the function movie_check().
This updates the life after every guess. I want the same to happen for my movie_temp array.
When i run this program, only the lives are updated properly, on correct guess the lives are not reduced, but in next turn the array_temp is not updated and the same array is displayed again and again after each gas.
How to create a function which return array and save it in movie_temp (just as I did for life).
IDE: Code::Blocks
Compiler: GCC Compiler
#include<iostream.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#include<conio.h>
void display_movie(char movie_temp[], int);
void display_life(int);
int win_player2(char movie_temp[]);
[Code] ....
View 4 Replies
View Related
Mar 6, 2015
I need to get the current time, have the system sleep for a period of time, then return the difference in seconds.
#include <iostream>
#include <string>
#include <ctime>
#include <time.h>
#define _CRT_SECURE_NO_WARNINGS
using namespace::std;
// in the <ctime> library is a function time(0)
[Code] ....
I'm not receiving an errors but the return value is not correct. It's returning 1.4259 no matter how long it sleeps for.
View 2 Replies
View Related