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
I would like to call a script from a makfile to glean some information about the OS. What I more or less need is the OS name and version (CentOS-5.9, OPENSUSE-12.2, Cygwin, etc). I think I can get the rest of what I need from uname. The OS name and version doesn't seem to reside in any consistent place over the various Linux flavors. I also need to get the version of the gnu c compiler, since I think that may also require a bit more involved scripting than I would like to try out of make.
The main question is weather I can call a script out of make and have it return a value for a variable.
I have called a C function inside C++ code. The .so which gets created is a 32 bit while I am looking for 64 bit . What all options should be mentioned in the Make file to eventually compile and get shared object of ELF64 CLASS ?
Excerpts from Makefile -----------------------------
how I can run this as a separate process from the parent program, like a child process,
and return the result back to the parent program.
this script is as follows.
if file "/Stuff/s" exists then continue to run, if file "/Stuff/t" exists, then print "started" if file "/Stuff/t" does not exists, then print "stopped"
if file "/Stuff/s" does not exist then print "quit" and then quit.
I have this problem for an assignment, and one of the functions that I created for it is nothing fancy; just a function that'll take in a number and error-check to make sure the input is valid. However, after doing it, when the program calls that function, it skips the cin statement and ends the program, without letting the user input his number. The function in question is called getSubLength.
Code: #include <iostream> #include <string> #include <iomanip> #include <cstdlib> using namespace std; const string JANUARY = "January";
in the below program for both class pointers pointing to null. Class contains normal function executing but class contains virtual function getting segmentation fault.
We have been assigned to create a program that uses multiple functions. The professor has given us code for two of the functions, one to open a file and then another one to read the files contents and output them. I have put these into my program but they will not execute. The program does run, but the functions themselves are not executing. I have practiced with other functions that contain no parameters and those run fine, but the functions she gave us have multiple parameters.
using namespace System; ref class A { public: A(){Console::WriteLine(L"A constructor");} virtual void func(){foo();} void foo()
[Code] .....
Supposing that class A is the development code; and so for unit-testing purpose I create a mock for it. But I don't know how to override A's constructor such that it will not get executed in my unit-test code.
I am currently working on a c++ project that will input students and process their grades. I encountered a problem and my code stops executing after the getScores function. Im not sure what the problem is, but im guessing its something within the function and the loops.
//Name: getScores //Description: Will get scores for student //Parameters: None //Return: testScore double getScores()
Is there a way to tell the program to continue reading the next line of code within a nested IF statement?
The reason I want to do this is because the two "else" statements in the following sample (the main and the nested else) will contain the same exact code and I don't want to repeat it twice. I know I can do this by creating a function and calling it from each else statement but I was just wondering if what I'm asking is even possible without using a function.
if(1 < 2) { // yes 1 is less than 2 if(5 > 10) { // do something } else { // no, 5 in not greater than 10 // here is where I want to tell the program to continue reading the next else statement
I have the following code in sourceFile.cpp. functionA() is first called and inserted entires for key1, key2 and key3. Then functionB() gets called to use the vectors for the 3 keys. I want to free all memory after exiting functionC(). Among the three ways to put an entry into the map for the 3 keys, which is correct / better?
Class ClassA { ... } ClassA *key1 = new ClassA(); ClassA *key2 = new ClassA(); ClassA *key3 = new ClassA();
I have an assignment to create a program that will display the duplicate numbers that were entered by a user. I have the code finished and I have covered the basic requirements of the assignment. However, during my testing I found that if I enter anything other than a whole number (i.e. char or float) the program will run out and exit. I would like to add a little code to verify that the user has entered a whole number. I cannot seem to get this to work though. I have written other codes that verify if a number is above and below a certain value, I just do not know how to look for a certain type of entry.Here is my code:
int main() { int number[20]; int duplicateNumber[20]; int i, j, k, counter = 0; // Get number input from the user for (i = 0; i < 20; i++) { printf("Please enter a whole number %d: ", (i + 1));
We've been tasked write a code which would mimic a secure entry keypad.. Only recognising the digits 0-9 for the passcode, and non-numerics S (start again) C (clear last digit) and E (enter) for the control. All other key strokes are to be ignored.
The passcode has to be <10 digits and represented on the screen by "****", with any keystrokes >10 ignored. The valid passcode being 4 digits (1234).
With 3 attempts to get the correct pass code, after each fail attempt as please try again message show, where after the 3rd attempt a specific message is displayed and an alarm sounds..
Still working on my first homegrown C program design . The function basically allows the user to enter a list of classes and grades and saves the list to a file to be used later in the file. The function compiles and runs through without error except for the fact that it always prints the last user entry to the *profilep file twice. Just as a note, the scanchar function is one I made to scan in one character and an end of line character to throw away the end of line char before I learned about %*c about 30 minutes ago...
Also I haven't much bothered to strengthen the function against crazy user input but I have heard using fgets and sscanf in conjunction can replace scanf and protect against weird user input. How to apply this within the program.
Code: // creates a new profile and prints it to the profile file. void newprof(FILE* profilep, const char *allclasses[ABBR_SIZE]){ int c, checker, counter; int i, a; char prof[MAX_PROF][ABBR_SIZE]; char grades[MAX_PROF][3];