C :: Error When Compiling WHILE Statement

Mar 6, 2013

Code:
/* Demonstrates using the gets() return value. */
#include <stdio.h>
/* Declare a character array to hold input, and a pointer. */
char input[257], *ptr;

[Code]....

I just got this from the book that I am using and it is for testing for input of a blank line and readers are being warned in using this format (line 18):

Code: while ( (*ptr = gets(input)) != NULL)

What is the correct syntax if a gcc compiler is to be used?

View 8 Replies


ADVERTISEMENT

C/C++ :: Error Compiling A DLL

Jul 25, 2014

I'm having a constant error in my DLL regarding one simple function: I get the error:

double *(double)' differs in levels of indirection from 'double (double)'

The declaration is:

extern EXP32 double *FAR PASCAL_CONV utc2tdb(double jd);

What can be the problem?

View 1 Replies View Related

C :: Compiling Makefile - Error

Feb 5, 2013

I've a problem compiling my makefile. The additional files are enclosed.

the error I get:
$make ./main
gcc -ggdb main.c
/tmp/ccPIxwjP.o: In function `main':
/home/ilan/Embedded_linux/Lesson-2-Makefiles/lesson-2.1/main.c:6: undefined reference to `func1'
/home/ilan/Embedded_linux/Lesson-2-Makefiles/lesson-2.1/main.c:7: undefined reference to `func2'
collect2: error: ld returned 1 exit status
make: *** [main.o] Error 1
$

Code:
my make file:
main : main.o file1.o file2.o
gcc -ggdb main.o file1.o file2.o -o gdb-main
main.o : main.c file1.h file2.h

[Code] .....

View 4 Replies View Related

C :: Structure - Why Error Comes When Compiling With GCC

Mar 18, 2014

Code:

#include<stdio.h>
#include<strings.h>
main() {
} struct employ {
char name[50];
float age ;

[Code] .....

View 2 Replies View Related

C :: Conflicting Types Error When Compiling A Lib

Dec 24, 2014

I'm trying to compile a library for use with PoLabs Pokeys 56U USB device (PoKeys56U) on Linux Mint 17 64-bit.

I'm using the information from here - New cross-platform library for all PoKeys devices - MyPokeys

When I run

sudo make -f Makefile.noqmake install

I get the following errors;In file included from PoKeysLibCore.c:22:0:

PoKeysLib.h:38:28: error: conflicting types for "int64_t"
typedef long long int64_t;
^
In file included from /usr/include/stdlib.h:314:0,
from PoKeysLibCore.c:21:

[Code] ....

Here is the offending code from the header file;

Code:
#ifndef __POKEYSLIB
#define __POKEYSLIB
#define USE_STD_INT

#ifdef USE_STD_INT
#include "stdint.h"

[Code] ....

View 12 Replies View Related

C++ :: Project Contain Three Files - Compiling Error

May 10, 2014

I am working on a small project which contains three files

1. MainTest.cpp
2. CashRegister.h
3. CashRegister.cpp

I have done everything that suppose to be done but still I am getting an error and can not execute the program....

Code:
// MainTest.cpp
#include <iomanip>
using std::setw;
using std::left;
#include <iostream>
using std::cout;

[Code] ....

View 14 Replies View Related

C++ :: Compiling Program - Unresolved External Symbol Error

Jan 17, 2013

When I try to compile a program from a C book I am following I am getting these errors, I have looked for ways to resolve it but I wasn't able to.

Errors:

Error3error LNK2001: unresolved external symbol _druk_instructiesC:UsersIvoDocumentsVisual Studio 2012ProjectsConsoleApplication2ConsoleApplication2Handspel.objConsoleApplication2
Error4error LNK2001: unresolved external symbol _speler_keuzeC:UsersIvoDocumentsVisual Studio 2012ProjectsConsoleApplication2ConsoleApplication2Handspel.objConsoleApplication2
Error5error LNK2001: unresolved external symbol _machine_keuzeC:UsersIvoDocumentsVisual Studio

[Code] .....

The .h file:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string>

#ifdef __cplusplus
extern "C"

[Code] .....

View 2 Replies View Related

C++ :: Error Message On Compiling - No Matching Function For Call To?

Nov 8, 2014

Every time I try to compile this, I get the error message, "error: no matching function for call to" on lines 18, 45, and 46. Basically every time I try to call on the function sales and printStock. I don't know what the message means or why I get it.

#include <iostream>
#include <fstream>
#define N 10
using namespace std;

void printStock (float [], int);
float sales (float [], int);

[Code] .....

View 6 Replies View Related

C/C++ :: Compiling Error - Local Function Definitions Are Illegal?

Mar 23, 2014

I am compiling and every time I get this error on this line ....

#include "r3dPCH.h"
#include "r3d.h"  
#include "r3dBackgroundTaskDispatcher.h"  
#include "d3dfont.h"  
#include "GameCommon.h"
#include "Gameplay_Params.h"  
#include "UIHUD_TPSGame.h"
#include "ObjectsCode/AI/AI_Player.h"

[Code] .....

View 1 Replies View Related

C++ :: Getting Error Using Enum In If Statement?

Jan 19, 2014

I'm trying to make a simple C++ program in which the user must try to guess a number, if they guess too high it says "too high" and if they guess too low it says "too low".

I also decided to add a feature which allows them to select how many tries they would like to guess the number. I tried to make "tries" type an enum so if the user could not pick an invalid number but for some reason i cannot use it in an if statement.

here is the code and i am getting the first error on line 27:

Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int guess;

[Code]....

View 7 Replies View Related

C++ :: Syntax Error If Statement

Feb 19, 2012

I got syntax error in if statement ,, i checked the line i put { after the condition don't know where the mistake are

1>c:usershani est11 est11code.cpp(20) : error C2143: syntax error : missing ';' before 'if'

PHP Code:

# include <iostream>
using namespace std;
int seqsearch (int list[],int length,int key);
void main () {
    int marks [30];

[Code] ....

View 2 Replies View Related

C++ :: Switch Statement - Error At Output

Jul 26, 2012

I have a question related to switch statement, which the switch in class employee2 gives me error at output. Program compiled well. I am using Code::Block Compiler V10.5. I have created object of class employee2 in main() function to get data from user, store it and display it. At the output, Compiler doesn't show actual output what i am expecting. The fun thing is my compiler printed emocion like (), where (hourly/monthly/weekly) was supposed to print.

Code:
#include <iostream>
using namespace std;
enum period {hourly,weekly,monthly};
class employee2 {
private :
char ch;
period x;
double compensation;

[Code] ....

View 10 Replies View Related

C++ :: Employee Database - Bizarre Error With If Statement

Dec 21, 2014

I have written a program that stores employees in a database object. You can Add, hire, fire, promote, demote, and display employees. The program uses an interface, a database class, and an employee class with member functions.

The strange behavior is in my switch statement in interface.cpp. I have a '#' that represents a command line. Add and Display functions are ok, but if I hire, fire, promote or demote. It will display '##' for the next input. I ran the debugger and after hire/fire/promote/demote is called, the first if-statement goes to 'else' and I'm trying to figure out why.

Note: main() calls mainMenu() to run the program

// interface.cpp
#include <iostream>
#include "database.h"
#include "display.h"
void mainMenu() {
displayMenu();
Database* employeeDatabase = new Database();

[Code] .....

Here are the two classes...

// database.cpp
#include <iostream>
#include <vector>
#include <memory>
#include "employee.h"
#include "database.h"
using namespace std;

[Code] .....

View 6 Replies View Related

C++ :: Checkers Game - Expected A Statement Error

Dec 4, 2013

im making a checkers game but i keep getting a 'expected a statement' error on the first 2 'else's

void Initialise(){
for(int row=0; row<3; row++) {
if(int row=0<3)
//player 1 pieces
string player = "Player 1";
for(int col=0; col<8; col++)

[code]....

View 4 Replies View Related

C Sharp :: Getting Syntax Error In INSERT INTO Statement

Apr 6, 2012

if (comboBox1.Enabled == true && textBox5.Text != "")
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data Source= c:usersmert" + @"documentsvisual studio 2010ProjectsPayrollCSWindowsFormsApplication7P ayrollDB.accdb";

[Code]....

this is my code. I am getting this error on "cmdole2" query.

error text is:

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

---------------------------
System.Data.OleDb.OleDbException (0x80040E14): Syntax error in INSERT INTO statement.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult)

[Code]....

View 1 Replies View Related

C++ :: Logical Error - Change Value Inside Void Statement

Jul 16, 2013

I've encountered a slight logical error in my code

/*
Lab06_pensionplans.cpp
Purpose :
- Create a simple financial application to calculate retirement plans
*/
#include <iostream>
#include <cstdlib>
using namespace std;
void displayMenu() {
system("cls");

[Code] ....

Look at case 2, which the user supposed to key in a new input, the problem is the value will never got into main function, I don't know what should I modify with the function.

Figured out I need to change the

void changeData(int startingAge, int numOfYears,
double lumpSumAmount, double yearlyAmount, double interestRate )

into

void changeData(int &startingAge, int &numOfYears,
double &lumpSumAmount, double &yearlyAmount, double &interestRate )

View 2 Replies View Related

C++ :: Error - Statement Cannot Resolve Address Of Overloaded Function

Nov 2, 2013

I can't seem to figure out whats causing this error: statement cannot resolve address of overloaded function . Error is before line 14 in bubblesortrand function. Thnx in advance.

void bubblesort(int num[], int a_size)
{
int i, j, temp;
for(i = (a_size - 1); i >= 0; i--)

[Code].....

View 4 Replies View Related

C++ :: Program To Order Pizza - Empty Controlled Statement Found Error

Aug 25, 2013

I am creating a pizza program for ordering a pizza and I have removed all the errors except for two. I have tried everything I can think of to fix this problem so it will compile, but to no avail. The only errors left are:

1>------ Rebuild All started: Project: Pizza Order App Midterm, Configuration: Debug Win32 ------
1> stdafx.cpp
1> Pizza Order Midterm.cpp
1> Pizza Order App Midterm.cpp
1>c:usersindia-n-jerrydocumentsvisual studio 2010projectspizza order app midtermpizza order app midtermpizza order app midterm.cpp(57): warning C4390: ';' : empty controlled statement found; is this the intent?

[Code] ....

The entire code is listed below seperated into 1 header and 2 cpp files.

// OrderPizzaApp.cpp : Defines the entry point for the console application.//

#include "stdafx.h"
#include "Pizza_Order.h"
#include <iostream>
#include <string>
using namespace std;

// prototypes
Pizza_Order createPizza_Order();

[Code] .....

View 5 Replies View Related

C++ :: If Statement Error - Match Text Variable That User Has Entered With Another Got From Array

Dec 3, 2014

I have an if statement that should either match a text variable that the user has entered and a another text variable that has been got from an array but they won't match even if they are the same,Im at a lost with it.

void displayQuestion(int noQuestion, string questionArray[], string answerarray[], string answer, double scorearray, double finalscore){

cout << questionArray[noQuestion] << endl;
cout << "enter an answer " << endl;
cin >> answer;

[Code] ....

View 1 Replies View Related

C++ :: Transfer If-else Statement Into Switch Statement?

Sep 7, 2013

How to make if else code below into SWITCH STATEMENT?

cout << "Enter the temperature: ";
cin >> temp;
cout << "Enter the pressure: ";
cin >> pressure;
cout <<endl;

[Code]....

View 6 Replies View Related

C++ :: Xcode 4 Not Compiling?

Mar 20, 2012

I'm taking an intro to c++ class and during an exercise I ran into multiple errors that are out of my knowledge to fix. The rest of the class is using Visual and that is all the instructor knows so i'm in my own figuring out Xcode. Basically I wrote the same program twice but one has a different struct and I get all sorts of errors with it. understand what the errors are and why they occurred.

The working program is this:

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
struct point {
public:
double x1,y1;
double x2,y2;

[code]....

This program does not compile and I get the following errors:

stl_iterator_base_types.h

1) Symantic Issue
No type named 'value_type' in 'myPoint'
2) Symantic Issue
No type named 'iterator_category in 'myPoint'
3) Symantic Issue
No type named 'difference_type' in 'myPoint'
4) Symantic Issue
No type named 'pointer' in 'myPoint'
5) Symantic Issue
No type named 'reference' in 'myPoint'

Why does one work and the other doesn't!?

View 14 Replies View Related

Visual C++ :: Compiling On X86 CPU?

Apr 30, 2015

I'm compiling some open source code (originally written for Linux / gcc) which uses the following line to determine if a particular section is being compiled for an x86 processor:-

Code:
#if ( defined(__x86_64__) || defined(__i386__) )

neither of those seems to be defined by my ageing compiler (VC++ 8.0). What would be the equivalent for building with VC8 ?

View 6 Replies View Related

C :: Redefinition Errors In When Compiling

Sep 8, 2013

have several linux header files included and when I compile my program I get the below errors..Am I NOT supposed to use some of these headers? Source is below as well.Looking through the headers mentioned in these errors, it's looking like stuff really is defined in multiple places...

Code:

codeblox@Lubuntu-pc:~/Programming/C/Network/MITM/src$ gcc -g -o mitm *.c
In file included from mitm.h:12:0,
from create_raw.c:1:
/usr/include/netpacket/packet.h:22:8: error: redefinition of ‘struct sockaddr_ll’
In file included from /usr/include/linux/netdevice.h:30:0,
from /usr/include/linux/if_arp.h:26,
from mitm.h:10,
from create_raw.c:1:
}

[code]....

View 5 Replies View Related

C :: Compiling 2 Files In Linux Gcc

Sep 22, 2014

I want to use two separate files in 1 program, but cannot get it to work. I don't know if it's my files or the compiling thats wrong. I have never used 2 files in my programs so far. Only used #include <stdio.h>.

Here are my files:
extern_static.c Code: extern int i;
int main(void)
{

[Code]....

View 10 Replies View Related

C++ :: FTP Program Compiling A File?

Mar 28, 2013

I have a FTP server, client program and thus I can easily transfer files, however what I want is to modify the program such that server receives a c/c++ file, compiles the output, and sends a text file back to the client containing the output. The program should also take note that errors are also transferred.

View 9 Replies View Related

C++ :: Program Got Crashed On Compiling?

Jun 25, 2014

I'm working for implementing the binary search tree .Everything looks fine but on compiling the code , the program got crashed .

code :

#include<iostream>
#include<stdio.h>
using namespace std;

[Code]......

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved