unable to run c++ in visual studio code on m1 chipset - c++

I have wrote a very simple program in c++
#include<iostream>
using namespace std;
int main()
{
cout<<"hello world";
return 0;
}
but its showing error in
Undefined symbols for architecture arm64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
please help me with this

Related

Firebase : Undefined symbols for architecture x86_64 (Configure Multiple project)

I am trying to compile main.ccp to configure my c++ project manually and have it connect to my own firebase.
#include "main.hpp"
#include <iostream>
#include "firebase/app.h"
#include "firebase/database.h"
int main()
{
firebase::AppOptions secondary_app_options;
secondary_app_options.set_api_key("API_KEY");
secondary_app_options.set_app_id("APP_ID");
secondary_app_options.set_project_id("PROJ_ID");
firebase::App* secondary_app = firebase::App::Create(secondary_app_options, "Secondary");
firebase::database::Database* secondary_database = firebase::database::Database::GetInstance(secondary_app);
return 0;
}
I use the command line to compile : g++ -std=c++11 main.cpp -o main.o
And it output:
Undefined symbols for architecture x86_64:
"firebase::App::Create(firebase::AppOptions const&, char const*)", referenced from:
_main in main-9988c0.o
"firebase::database::Database::GetInstance(firebase::App*, firebase::InitResult*)", referenced from:
_main in main-9988c0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did correctly download and locate all of the framework and library for firebase already. Can anybody help me with this ?

Working on CS106B through SEE, continued "ld: symbol(s) not found for architecture x86_64" errors when using their libraries

I'm using Eclipse and have been including the relevant libraries in the project folder as I build. Now that I'm a bit further in the course, I'm trying to
#include "vector.h"
but building gives 16 warnings that look like:
In file included from ../CS106B_Prog_Ass01_05.cpp:6:
Finished building: ../CS106B_Prog_Ass01_05.cpp
../vector.h:560:26: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
and the following error that prevents the project from building:
Undefined symbols for architecture x86_64:
"mainWrapper(int, char**)", referenced from:
_main in CS106B_Prog_Ass01_05.o
"__mainFlags", referenced from:
_main in CS106B_Prog_Ass01_05.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [CS106B_Prog_Ass01_05] Error 1
I would love to simply link to the library folder, but that results in a similar error even if I switch it to a different architecture. Has anyone had this problem?

Qt, clang & PortAudio: what does those errors mean?

I write a cross-platform audio processing program. It uses Qt 5 and PortAudio library. The platform is Mac OS X Yosemite, clang compiler, Qt Creator 3.4.1 IDE. I got those linker errors:
Undefined symbols for architecture x86_64:
"_ellie2", referenced from:
_main in eltst.o
"_hypergl", referenced from:
_main in ltstd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What does it mean and what needs to do?

Error compiling C++ code with Objective C

I'm trying to pass the value using parameter from Objective c class to C++ class. Below is the code I'm using to pass the value:-
std::string cpp_str([str UTF8String], [str lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
wrapped.ExampleMethod(cpp_str);
While compiling in Xcode its showing the below error:-
Undefined symbols for architecture i386:
"Test::ExampleMethod(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
-[ViewController exampleMethodWithString:] in ViewController.ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please give reply that how should I do this?

Undefined symbols for architecture x86_64:"cv::face::createFisherFaceRecognizer(int, double)", referenced from: _main in main.o

I am working on facial recognition in video using opencv. I followed the tutorial on opencv's website(http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html). I get following error when I try to build my code in xcode.
Undefined symbols for architecture x86_64:
"cv::face::createFisherFaceRecognizer(int, double)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation).
I made a few changes to the code as given in here fatal error: opencv2/contrib/contrib.hpp' file not found (open cv already built)
Please guide me through it as I am new to opencv.
Thanks in advance!