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


ADVERTISEMENT

C :: How To Create A Library Using Xcode

Feb 2, 2013

I'm completely new to C, and I don't know how to create a library using Xcode.

View 5 Replies View Related

C/C++ :: Reading From A File In Xcode

Mar 18, 2014

typedef struct dvdtype{
int dvdcode;
char title[50];
int customerID;

[Code]....

i am trying to write this program about a dvd club...i have functions that insert,delete,rent,print movies..I also have to make 2 other functions..Save to file and load from file..My function for saving to file is exactly the same as the one i posted except instead of "r" i put "w" and fprintf for fscanf and fgets..So my function for saving works ok...(in xcode i have to use the full path of a file) but this one does not work...If i call the function from the main menu it does not print Error neither does it say that there is something else wrong...When i gave the number 6 for example to call the function,afterwards it is like the program is waiting for me to give number or characters..it is like using scanf...I write anything and press enter and nothing happens ,it is like asking for data again..i give some numbers or letters and press enter for 5 or 4 times and it displays the menu and asks to choose what to do again, as if nothing happened ,without printing the values that are inside the file..

View 14 Replies View Related

C/C++ :: Access C-library Using Xcode?

Jan 25, 2014

im having trouble accessing the c library on my mac. The reason being is i need to get the code for pi for my program.

View 1 Replies View Related

C++ :: Where Is The Path For Header Files For Mac Xcode

May 27, 2013

I want to include turboc.h file for some project

where do i have to add this file for mac xcode?

View 1 Replies View Related

C/C++ :: Running Multiple Terminal In Xcode

Oct 5, 2014

I am using Xcode to do c++ programming and I have a c++ code, with different input arguments. I want to achieve that in Xcode, I could run multiple simultaneous running of my c++ code. However, the current problem is that once one code finishes, its terminal window automatically closed and I do not have time to look at its result. Thus computer time is wasted. Is there a way to run multiple same c++ code with different arguments input?

View 6 Replies View Related

C/C++ :: Linking Boost Thread With Xcode

Sep 30, 2014

I have built Boost from the website using

./bootstrap.sh
./b2 install

I think all are installed properly. I am trying to use Xcode to include the library of boost:thread.My code links to the header file properly with " #include "boost/thread.hpp"" commented, as seen from the following:

However, it could not link properly to boost-thread if "#include "boost/thread.hpp"" is un-commented.

Error page is shown as:

I have linked the dynamic library libboost_thread.a and libboost_thread.dylib and included /usr/local/include into header search path and /usr/local/lib into library search path.

View 1 Replies View Related

Software :: Xcode Command Line Tool?

Mar 12, 2015

using cs50 videos. I'm working on writing a caesar cipher program(pset2) in c using Xcode and the command line tool. So far I just press play and it compiles and runs my source code. Now I need to use command line arguments, how do I enter command line arguments with the tools I'm using?

View 1 Replies View Related

C++ :: SDL2 Framework - Loading MBP Files In Same Folder In XCode 5

Feb 23, 2014

I am trying to load a .bmp file located in the same folder as main.cpp etc. but I'm not sure what to input as the resource path so that it picks it up and, when I distribute it, I want it to be preferably cross platform and run smoothly.

I have tried using:

hello_world.bmp
SDL_Game/hello_world.bmp (SDL_Game is the name of the project)

but it will work if I use the full path. I don't want to do this though, because then it will not work on other computers and platforms.

This is the function I use to load media:

bool loadMedia() {
// Loading success flag
bool success = true;

// Load splash image
gHelloWorld = SDL_LoadBMP("hello_world.bmp");

[Code] ....

I am using XCode 5, SDL2.0.1, OSX 10.9 Mavericks and C++.

View 2 Replies View Related

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

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 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 :: 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 :: 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 :: 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 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

C/C++ :: Compiling With One Header File?

Oct 21, 2014

I am trying to compile two programs using the same header file and definitions. makefile part to make this work.

================================
My headerfile looks like this:
#ifdef ONE
void hello(int s);
#else

[Code]....

How can I include the flag -DONE in my makefile so that
it includes void hello(int s); for "one" and
int pin;
int verification(char* name);
for "two"

View 2 Replies View Related

C++ :: Ignore Code When Compiling?

Sep 7, 2012

In a rather large codebase, there is a set of recurring calls to a couple vararg functions (mainly for logging)

Code: logthis(foo, bar(), somefunction(parameter1,parameter2), somethingelse);

The number of parameters to this function is variable It has all types of variables, function calls, etc.

The code has thousands of these lines

There is now a need for a special version of the compile that will remove a lot of the code, among others is the logging.

Can I somehow #define the "logthis" name into something that'll remove all actual calls to the code. including the actual parameters/expressions to the call.

I can't afford to add #ifdef/#endif around each of the calls because there are too many of them, and because that'll cause some undisired side effects in our code conformance tests.

Code: #define logthis __noop

comes close, that removes the call, but it still causes the compiler to evaluate and validate all the parameters to the logthis function, which doesn't work because in this case, removing the logging headers also removes other members of the class that get used as part of the parameters to logthis()

if I could define logthis into // resulting in all the rest of the line being comments, but that doesn't work.

Preferably I'd like something to be portable, but I'll take a solution that only works on visual studio as well.

View 6 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 :: Best Process For Cross Compiling Application

Oct 26, 2013

I'm creating a small command line game in C. I have never done anything cross platforms, but this is small enough (so far) that it might not be too bad.

When I am done, I'm not sure how it will be distributed: Either I will just send people the C files and say "compile on your system with these options", or I will just have executables for various systems. Probably Windows 7/8, Ubuntu, CentOS, and whatever I can find to test on.

I right now I'm testing/developing on Windows 7 using MinGW. So my questions are: while I'm developing, how should I be compiling/testing it?

View 4 Replies View Related

C :: Virus Alert While Compiling Program

Jul 7, 2014

While I was trying to compile simple c program, I saw this virus alert:

Win64:Evo-gen [Susp]

View 9 Replies View Related

C :: Compiling Warning - Output Is Garbage

Mar 23, 2013

I'm working on my program that takes input of the employees' first and last name, their payrate, their deferred from check and also the amount of hours they have worked which then the gross is calculated and also the taxes are calculated by an external function. In the program design it is necessary to put arrays which I have done, but when i compile I receive warning messages

Code: warning: format '%s' expects argument of type 'char*', but argument 3 has type 'double'

Warning: format '%f' expects a matching 'double' argument [-Wformat] which I believe is causing my program to just give me garbage when I run it. What do those warnings mean?

Code:
/* Name: Arturo
Date: 03/22/13
Purpose: To learn
*/
extern void calculate taxes(float gross,float deferred, float *ft, float *st, float ........i);
void ovtHrs(float *hrs_wrk, float *ovt_hrs, float hrs, float *gross, float payrate);
void netPay(float gross, float deferred, float ft, float st, float ssi, float *net);

[Code] .....

View 9 Replies View Related

C++ :: Cmath Errors Compiling DOOM

Mar 30, 2013

I've recently downloaded the original DOOM source code from id Software's GitHub page. I decided it would be fun to port it to Windows 7. I created a new Win32 application within Microsoft Visual Studio 2010 Professional, added all the DOOM files to the project, and hit compile. I got a ton of odd errors, so I switched the project from C++ to C and hit compile again. I got a few more errors, which I've mostly resolved (they come from the fact that the DOOM code I downloaded was written for Linux in 1993), and an error on nearly every symbol in cmath. The errors are C2059 and C2061. A little bit of digging around online revealed that these errors come from including cmath in a C project. However, I can find no reference to cmath in my code files.

A little more digging around online revealed that certain C++ files, like fstream, include cmath. I removed all of those that I could, but to no avail. How I can get rid of these errors?

All the code in this project so far can be found at [URL] ....

View 3 Replies View Related

C++ :: Compiling Errors In Template Class?

Mar 22, 2014

what my compiling errors mean, and what I should do to fix them: The following is my header & Implementation files. Note, the purpose of this class is a built in Array.

Header File:

#ifndef ARRAY_H
#define ARRAY_H
#include <iostream>

[Code].....

View 5 Replies View Related







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